How to get stack traces that include Java-side exceptions to show root cause?

If I have problem on the Java-side implementation, the default error
handler only shows the topmost Java exception. What is the best way to
get the information from nested causes?

Or to explain this in computer words: https://gist.github.com/4116981