Type-Safe Error Handling
Toryx implements Rust's proven Ok/Err pattern to eliminate error handling chaos. Build more reliable applications with consistent, predictable error management that scales with your project.
$npm i @toryx/coreThe error handling problem
Inconsistent error handling
Every developer on your team handles errors differently, making code reviews a nightmare and bugs inevitable.

Try-catch hell
Nested try-catch blocks turn clean code into unreadable spaghetti, hiding business logic under layers of error handling.

Silent failures & lost context
Errors get swallowed, stack traces disappear, and debugging becomes a guessing game instead of a systematic process.

No type safety
TypeScript can't help you with traditional error handling you're left wondering what exceptions might be thrown and when.

Toryx Error Handling for JavaScript
Start building reliable applications with type-safe, predictable error handling that developers actually enjoy using.
Type-Safe & Predictable
Toryx implements Rust's proven Ok/Err pattern, giving you compile-time guarantees about error handling. TypeScript knows exactly what can go wrong, so you can handle it gracefully—every single time.
- Full TypeScript inference
- No surprise runtime exceptions
- Errors as values, not exceptions
Clean & Consistent
Say goodbye to nested try-catch spaghetti. Toryx provides one standard, elegant pattern for error handling across your entire codebase, from APIs to forms to database queries.
- Flat, readable code structure
- Team-wide consistency
- Easy code reviews
Battle-Tested & Lightweight
Built on error handling patterns proven in production by millions of Rust applications. Zero dependencies, minimal footprint, maximum reliability.
- Inspired by Rust's Result type
- Zero runtime overhead
- Works with existing code
See the Difference
The same async operation, two approaches. One clear winner.
Traditional Try-Catch
Nested, unclear, error-prone
tsxWith Toryx
Clean, explicit, type-safe
tsxPlug into your stack
Official integrations for popular frameworks, with more on the way
Express.js Middleware
Drop-in error handling middleware that transforms your Express app's error management. Catch errors automatically, transform them into consistent responses, and maintain full type safety.
- Zero Config
- Type-Safe
- Safe error response
Coming soon
Coming soon
Want to be notified when your framework is supported ?