Problem Statement
Explain exception propagation, chaining, and best practices when designing APIs for exception handling.
Explanation
When a method does not handle an exception it propagates the exception up the call stack to its caller. You may wrap a low-level exception in a higher-level custom one (exception chaining) to add context while preserving original stack trace. Design APIs so that you throw meaningful exceptions, don’t leak internal implementation details, document exceptions a method may raise, and avoid over-catching (which hides bugs). Good exception design enables maintainable and clear error handling.