Exception Handling
Design for the unexpected
Designing an application for the unexpected is key for a solid implementation. This means, you must not only design for the requested functionality (green path), you must also think about and handle unexpected situations that prevent your functionality from completing as expected (red path).
💡 I personally use the word exception (instead of error) for an unexpected event that leads to a situation in which the code cannot be executed any further. An exception leads to the immediate termination of the execution.
In contrast, an error is an expected event that can be handled and after which the code can normally be continued. In some cases, an error can turn into an exception and the execution can be cancelled. However, the trigger for the cancellation is always the exception, not the error.
Last updated