As seen in other error handling articles, particularly in exceptions vs error values, you can do error handling with exceptions or error values.
If you’re using error values, you probably want to avoid exceptions. However, you may be using other code which throws exceptions.
In this case, do what Joel does to avoid exceptions:
- don’t throw your own exceptions
- catch and handle every possible exception immediately
Credits
- Robot – Photo by Aman Pal on Unsplash