System Reliability

System Reliability

Build systems that stay dependable under stress

Enforceable guidelines from our catalog

Avoid Uncaught Exceptions in Production

Code running in production must handle exceptions appropriately. Uncaught exceptions are a major source of service failures. If an error occurs, handle it gracefully or let it propagate with proper context to a higher-level handler.

Use Custom Exception Classes

Create custom exception classes when built-in exceptions are not sufficient. Inherit from appropriate base exceptions and consider using exception chaining with ‘raise from’ for better error context.

Use Exception Chaining with ‘raise from’

When re-raising exceptions or raising new exceptions due to another exception, use ‘raise NewException() from original_exception’ to preserve the original traceback and provide better debugging context.

Sign up for free
and get unlimited access to our guidelines catalog