Success values are returned directly with no wrapping. Error objects only created when needed.
// Success: Direct return
const result = trySync(() => parse(data));
// result is ParsedData | TryError
Start simple with basic error handling, add complexity as needed. No need to rewrite existing code.
// Start simple
const result = trySync(() => operation());
// Add retry, timeout, etc. later
Full type inference, discriminated unions, and strict null checks. Built for TypeScript developers.
if (isTryError(result)) {
// result is TryError
} else {
// result is success type
}
Compare traditional error handling with tryError's approach