Timeline for How to write a good exception message
Current License: CC BY-SA 2.5
3 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 10, 2016 at 15:51 | comment | added | bytedev | I also disagree. Exception types should make sense to the calling code that will consume it. For example if I'm calling a framework and this causes a FileDoesNotExistException internally then this might not make any sense to me as a caller of the framework. Instead it might be better to create a custom exception and pass in the thrown exception in as the inner exception. | |
Dec 23, 2010 at 13:51 | comment | added | Felix Dombek | I disagree. There are many good reasons to implement your own exceptions when the language API doesn't cover your exact needs. One reason is that in a method where multiple things may fail, you can write different catch clauses for different types of exceptions, where you can react to the exact problem. Another is that you can separate multiple layers of exceptions representing different layers of abstraction, where the exact layer that an exception belongs to can be encoded in its type. Just using "Exception" or "IllegalStateException" and a message string doesn't help much there. | |
Dec 23, 2010 at 12:26 | history | answered | Conor | CC BY-SA 2.5 |