Timeline for Is it more sensible to log exceptions in a catch-all or in a base exception class?
Current License: CC BY-SA 3.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 27, 2022 at 22:24 | comment | added | einpoklum | "When you throw an exception, it is because your code has reached a state where it can not proceed correctly." <- This is ideally the case, but in reality - exceptions are thrown not because the code cannot proceed, but because it's easier to throw and forget than to handle the error. | |
| Apr 21, 2015 at 18:36 | comment | added | supercat | Are there no logging frameworks which could conveniently handle the concept of "Here's a bunch of stuff which should get logged unless it gets superseded"? Each layer that sees an exception could supersede the data from the previous, except that if a new exception gets thrown in the course of stack unwinding the last log report would not get superseded and would thus get recorded. Do no frameworks support such a pattern? | |
| Dec 1, 2011 at 17:24 | vote | accept | yannis | ||
| Nov 28, 2011 at 0:37 | vote | accept | yannis | ||
| Nov 28, 2011 at 0:37 | |||||
| Nov 25, 2011 at 0:49 | vote | accept | yannis | ||
| Nov 25, 2011 at 0:49 | |||||
| Nov 24, 2011 at 12:16 | comment | added | unholysampler | @YannisRizos: Yes, you should implement the catch-all as your first step. What I said about the catch-all was more to ensure that you did not use it as a normal part of your code flow. Implementing an unhandled exception handler is important because it allows you to get lots of information every time your code does something every bad. | |
| Nov 24, 2011 at 5:22 | comment | added | yannis | I've added some clarifications on the question prompted by your answer. From what I gather, on the practical side of the question you propose to log in the catch-all? | |
| Nov 24, 2011 at 4:50 | history | answered | unholysampler | CC BY-SA 3.0 |