How to use error values in an exception-based language

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
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments