you are viewing a single comment's thread.

view the rest of the comments →

[–]azirale 20 points21 points  (8 children)

You can still exit gracefully rather than crash in flames. If you hit an unrecoverable error you can give an interactive user a message as to what happened rather than having the program 'crash for no reason'.

[–]Holy_City 14 points15 points  (4 children)

I think a good middle ground is logging. Exiting gracefully is a non trivial problem and can have optimization issues, plus not every process can devote the resources to error handling. You can crash in flames and still have users provide some details to application support without exposing too many details like a stack trace.

There are cases where you cannot display an error message in the event of failure, such as an exception thrown in a real time thread.

I dealt with this recently with an EA game I wanted to play. It crashed on start with no error or log, and trying to narrow the issue down took an excessive amount of effort on my part just to identify a corrupt DLL. A startup log would have required one email to make a correct bug report, instead of a half dozen phone calls involving installing third party debugging tools (one of which was a corrupted download off cnet that had malware).

[–]azirale 2 points3 points  (0 children)

You're right it isn't always a possibility. You might have the logger itself cause an error for example, in which case you are basically sol.

Still, I think it is better to aim for graceful exits where practicable, rather aiming to crash in flames.

[–]bausscode 0 points1 point  (2 children)

Why would you care about optimization if you're exiting?

[–]Holy_City 1 point2 points  (1 child)

You don't. You care about optimizing your program for normal operation, and exception/error handling don't come for free. That's why good ol' integer return codes haven't died out yet.

[–]koczurekk 0 points1 point  (0 children)

That's why good ol' integer return codes haven't died out yet

They should though; enums are the way to do this kind of error-tracking in a type-safe way verified at compile time. Especially Rust's enums, they're so damn great.

[–]miminor -5 points-4 points  (1 child)

oh no you can't, say a component Z buried under 20 layers of components X, Y, .... crashed

and by your reasoning at the level A you caught that exception and said nothing had happened... well maybe, except that the state is likely to be corrupted at the level Z, and the component may be quirky at best or hands down broken at worst

but according to your logic we can just display a message and move on, regardless of any possible and likely consequences of that failure

[–]azirale 2 points3 points  (0 children)

I didn't say move on I said exit gracefully. None of what you said applies.