4 ms·
People misuse exceptions. They use them as control-flow, like another form of "if...then", and as you point out, they're terrible for that. The proper way to u
by xamuel 9y ago
People misuse exceptions. They use them as control-flow, like another form of "if...then", and as you point out, they're terrible for that.
The proper way to use exceptions is when you want behavior that bubbles up. So if you do x=f(g(h(x))) and h(x) fails because the user didn't configure something, you only need the config-checking logic in h, not in g or f. This use-case is quite rare though, and overall not worth the extra language complexity.