Non-exception Error Handling Techniques
Learn about non-exception-based error handling techniques like callbacks, PHP error messages, default values, and sum types.
The following techniques are among the error handling techniques that are not based on exceptions:
- Callbacks
- PHP error messages
- Default values
- Sum types
Callbacks
A callback is a function that serves as an argument of a higher-order function. Callbacks mitigate failure when they’re used in place of exceptions. Consider the following snippet:
Get hands-on with 1300+ tech skills courses.