Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
Like you said, exceptions are for unexpected, everything else is an error and should be dealt with immediately. Now like 99% of the time you expect to get an error, rest 1% of cases are almost never encountered, but most languages still provide very basic exception mechanism (don’t know in case of rust though).
The reason why exceptions are evil is because they are misused for above reason. They are used for error handling when they shouldn’t. Now let’s say you have huge application, every exception got so abstracted, they got scattered everywhere, there is no central error handling anymore, because it’s everywhere and nowhere. Then someone finally thinks that some exception is not necessary to be thrown and program can continue working without it, so they catch it and allows application to continue running. Even worse scenario that exception doesn’t have it’s own instance and is global, oh boy then shit could go wrong in that case.
To sum up, exceptions promotes bad design and thus should be avoided, instead errors should be handled immediately, either it’s by printing and terminating everything right away or passing that error to other function. You say that’s a lot of boilerplate code? That’s right, but at least it’s maintainable.
12bitfloat159713d@SevenDeadlyBugs Error return codes or sum types or however it is handled else isn't better than exceptions. Exactly the same argument could be made for them: "It's annoying so people just ignore it by relying on getting the right type and panic'ing else."
There's no difference between checked exceptions and explicit error handling. The only difference is that exceptions *also* work for cases where error handling isn't possible otherwise. It's just a design decision and if people decide that normal error handling looks better or is more intuitive or whatever then fine, but you still need exceptions
So why work with language/stack you don’t like?
If it’s for money, start looking for another job in a stack you want to.
Your Job Suck?
Take a quick quiz from Triplebyte to skip the job search hassles and jump to final interviews at hot tech firms
Get a Better Job