Skip to content

Exceptions

Joël R. Langlois edited this page Jan 29, 2025 · 3 revisions

Don't Use Exceptions, No Exceptions

In no particular order:

  • They make code overall really difficult to follow.
  • They're completely unfair to users of your code.
    • If you fail to document the possibility of exceptions, you're going to break user code.
    • You've made a confusing API by not making it unsurprising.
  • They risk leaving objects and data in bad states, typically because you or another developer forgot to account for something.
  • They make refactoring exceptionally difficult and bug prone.

Just avoid this evil feature. It's designed in bad faith.

Clone this wiki locally