2 ms·
> you know what is even worse ? the programmer "handling" the error and just displaying a "we're sorry, an error has occured" message to the user This occurs a
by littlestymaar 6y ago
> you know what is even worse ? the programmer "handling" the error and just displaying a "we're sorry, an error has occured" message to the user
This occurs a lot with language with exceptions too: you need to “handle” the exception before it reaches the root, otherwise it crashes the whole software (which is basically the same behavior than a panic in Rust or Go), so people usually add this kind of catch-all exception handling in Java or any language with exceptions. Have you ever encountered a “500 internal server error” while browsing so website? That's it.
The main difference is that you can't do any better when using exception because you can't easily list all possible exceptions that can reach the root, while you can in languages with sum type.
Of course there will be lazy programmers in any language, the problem with exception is that even if you aren't lazy, you cannot really do better than people who are (unless you can disable exceptions, like in C++ …).