Error Handling
v1.0.0
Reviews error handling patterns — error boundaries, structured logging, graceful degradation, and user-facing error communication. Silent failures and swallowed exceptions are the leading cause of "it works on my machine" bugs that only surface in production.
Quality(11)
Don't expose internal errors or stack traces to users
Return a generic, safe message to clients while logging full details server-side. Leaking stack traces, SQL, or file paths aids attackers and confuses users.
Fail fast and handle errors at boundaries
Let errors propagate up to a well-defined boundary (request handler, route, job runner) instead of catching them mid-flow. Centralizing handling keeps core logic clean and recovery consistent.
Log Errors with Context
Always log errors with structured context: user ID, request ID, input data, stack trace. An error message like "Cannot read property of undefined" with no context is impossible to debug — you don't know which user hit it, what they were doing, or how to reproduce it.
Automate Error Handling checks on every PR
BeforeMerge scans your pull requests against all 11 Error Handling rules automatically. Get actionable feedback before code ships.