4 ms·
> and just propagates to the user, who often doesn't even have access to the documentation of the underlying library, and must perform Google search on some cr
by jcelerier 6y ago
> and just propagates to the user, who often doesn't even have access to the documentation of the underlying library, and must perform Google search on some cryptic error message, just to discover that the program is failing because some log formatting library he doesn't care about cannot have access to the configuration file it expected. This is a terrible user eperience.
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 who now has exactly zero way to know what is going wrong.
Or as seems to be common in Rust, Go, and other exception-free systems, just calling panic! ... yay, "error handled".
It is very irrealistic and presumptuous to assume that your program has enough domain knowledge about its users's systems to handle every single error.
- Ar-Curunir 6y agoYou don't have to handle those errors if you don't want to; you can just use `Box<dyn Error>` to propagate them without caring.
- 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++ …).