5 ms·
When I'm coding I normally think about 2 things: - What should I do here to help me and other developers understand what's gone wrong. This generally results i
by islon 14y ago
When I'm coding I normally think about 2 things:
- What should I do here to help me and other developers understand what's gone wrong. This generally results in one of the three categories:
- Is it a "shouldn't happen" error like hardware malfunction, internet down, etc.
- Is it a invalid data error, someone screwed data and I got the error here.
- Is it a algorithm error, I got something wrong in my code and this wasn't supposed to happen.
- What should I show to my user. Divided in three categories too:
- Unrecoverable error: should show a big red screen.
- Recoverable error: should show a informative message with instructions.
- Errors that don't affect the user: no need to show anything, just log the error.
- stinos 14y agoall well, but that 3rd one highly depends on context. If I have an application for collecting/analysing data that is going to be used to publish papers and whatnot, it is absolutely critical the algorythms I write are ok no matter what. If they are not, it's time to go berserk (as in the 1st one). Ignoring it would be the worst I can do at that point.
- HeyLaughingBoy 14y agoThere's a third thing to consider: how to recover from the error. In many cases, the recovery is something the software has to do itself: e.g., server down, switch to alternate server. My preference is to consider error reporting as something completely separate from error handling. This is even more the case if you have different classes of users.
- Roboprog 14y agoWho is this "user" you speak of? :-) I'd extend that a bit for batch systems: invoke some kind of tool to file a trouble ticket to get the operations/support group's attention, as there won't be somebody sitting at a console to watch. Alternately, you could view this as generating a big red screen, just realize that any users are sitting "someplace else". Yeah, some of us still have batch operations going, as well as a web app or two.