4 ms·
disappearing stack trace In many (most?) OO-languages it takes a surprising amount of gymnastics to properly chain exceptions. Especially if you're a library-a
by moe 14y ago
disappearing stack trace
In many (most?) OO-languages it takes a surprising amount of gymnastics to properly chain exceptions. Especially if you're a library-author depending on other libraries.
The blame goes squarely to the language designers here. This feature should be baked into the core of every language because adding it with a 3rd party library is far from trivial in most.
Here's an example of such a library (ruby): https://github.com/pangloss/nested_exceptions https://github.com/pangloss/nested_exceptions
Use it!
- Roboprog 14y agoFor all my grumbling about Java, I guess exception chaining is one thing they actually did get right from the beginning: throw new RuntimeException( "App feature X broke ...", e); Could be worse, could be C -- setjmp/longjmp :-) Actually, longjmp is pretty useful, but it typically makes for "course grained" error handling, and you better have a good error message logged before jumping back. As well as protect yourself from resource leaks...