|
|
|
|
|
by resonious
318 days ago
|
|
I think it's impossible to come up with a good rule of thumb for error handling. Sometimes catch-and-log is what you want. Sometimes catch-and-reraise is what you want. Sometimes let-it-fail is what you want. I really cannot come up with a good argument that one of these is the better default. Languages should force us to consider which failure mode we want for every function that can possibly result in error. The most egregious thing to me is the fact that most languages let any function throw any error it wants without requiring that be documented or part of the type system or anything. |
|
There is no rule of thumb because the scenarios are too varied and context matters.