380 B
380 B
Shared Error-Handling Patterns
- Subclass
Errorwith typed messages - Never swallow errors silently
- Prefer
Result<T, E>return types in business logic - Log only at boundaries, never inside pure functions
- Validate inputs only at the system edge
- Treat all third-party API responses as untrusted input
- Bail early on contract violations rather than degrading silently