Print stack tracing with SuperDevMode obfused
I have this code to handle thrown exceptions using GWT:
GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
@Override
public void onUncaughtException(Throwable throwable) {
// Iterate over the trace and then print with $wnd.console.log
printStackTrace(throwable.getStackTrace());
}
});
However, the log printed in the browser console looks like this:
"Unknown.Ol(Unknown Source) Unknown.Nl(Unknown Source) Unknown.Vl(Unknown Source) Unknown.Hu(Unknown Source) Unknown.Ku(Unknown Source) Unknown.ju(Unknown Source) Unknown.h6(Unknown Source) Unknown.As(Unknown Source) Unknown.j6(Unknown Source) Unknown.u6(Unknown Source) Unknown.L3(Unknown Source) Unknown.k5(Unknown Source) Unknown.hn(Unknown Source) Unknown.mn(Unknown Source) Unknown.ln/<(Unknown Source) Unknown.anonymous(Unknown Source)
How can I show this actual stack trace like the old GWT style?
+3
source to share
1 answer
This worked for me, keep in mind that this is not ideal, but it will give you the file and line numbers in your stack trace. Yes, this works with gwt 2.7 and super dev modes. You need to add this to your * .gwt.xml file. You can turn this off for production because it adds quite a lot of code bloat, but makes debugging a lot easier.
<set-property name="compiler.stackMode" value="emulated" />
<set-configuration-property name="compiler.emulatedStack.recordFileNames"
value="true" />
<set-configuration-property name="compiler.emulatedStack.recordLineNumbers"
value="true" />
+3
source to share