DEV Community

Discussion on: Sometimes, in the heat of the moment, it's forgivable to cause a runtime exception.

Collapse
 
qm3ster profile image
Mihail Malo

For the longest time, my issue with catching anything ever was silent failures, which I experienced in other people's code.
But now, I just:

  • match errors I want to handle very strictly by message or my custom constructor
  • wrap native errors in my own semantic error types
  • rethrow anything that didn't match
  • use framework error boundaries
  • rethrow in prod after reporting

And life is good.