Error Handling

General

// Definition

The code logic that intercepts and responds to failures — network timeouts, unexpected input, downstream service errors, and exceptions — preventing crashes and providing meaningful feedback. Error-handling paths are among the most under-tested surfaces: they are rarely exercised in the happy path but are critical for resilience and user experience under real-world conditions. Testing strategies: force the failure condition (inject a 500, disconnect the network, supply invalid input); verify the application surfaces a user-friendly message rather than a raw stack trace; confirm the app recovers correctly when the error clears; check error logs contain enough context to diagnose without exposing sensitive data (PII, tokens, internal paths).

// Related terms