3 ms·
Why are they a poor choice for the latter? They have a type, make it say MissingUserException and the special place can handle it in a special way. Ensure it i
by AstralStorm 7y ago
Why are they a poor choice for the latter?
They have a type, make it say MissingUserException and the special place can handle it in a special way. Ensure it is a subclass of some general exception type you also handle elsewhere and you're good.
Often people throw generic exceptions instead of using the type system.
- dllthomas 7y agoIn the latter case you will often want to pass "data or the fact the data was missing" along to other functions. With a result value (of whatever form) that's trivial. With exceptions, it's certainly plenty doable but it's messy.