4 ms·
Typed exceptions convey a bit of information to enable specialized handling at runtime, they are not meant to try and make debugging easier.
by P5fRxh5kUvp2th 4y ago
Typed exceptions convey a bit of information to enable specialized handling at runtime, they are not meant to try and make debugging easier.
- Sakos 4y agoI'm not sure what you mean by "they're not meant to". They work, I don't care what they're "meant to" do. It also helps with general analysis of logs.
- P5fRxh5kUvp2th 4y agoIt's redundant. The message (a string) will give you that information, nothing is lost by catching a base Exception and writing it to a log. typed exceptions is about special handling. The type information allows the programming language to offer special handling when that is necessary, it is NOT meant to replace good error messages. But it also isn't about taxonomy, which is something that a lot of people miss. It's putting the cart before the horse. --- But you specifically talked about debugging. If you're talking about interacting with an attached debugger, the developer already has everything they need, there is no reason why specific, typed, exceptions are needed to assist that. so you MUST be talking about general debugging by reading logs and the like, but those logs will tell you both the error message and the stack trace with the specific line that originally threw. Unless, of course, you're catching and rewrapping the exception and throwing that information away...