GWT客户端大小写在java中获取完整的错误消息 [英] GWT client umbrellaexception get full error message in java
本文介绍了GWT客户端大小写在java中获取完整的错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用GWT,但是我发现几乎不可能在Chrome控制台中发现当前的错误消息。在本地开发模式下,当我在GAE上托管应用程序时,我会收到错误。如何获取实际的java错误?哪里说哪一行,有什么异常?和btw我正在寻找的错误是什么?
I'm working with GWT currently but I find it nearly impossible to find errors with the current error messages in the Chrome console. I get the errors both when in local development mode and when I'm hosting the app on GAE. How do I get the actual java error? Where it says which line and what exception I got? And btw what is the error I'm looking for called?
提前感谢
推荐答案
在GWT 2.1.1中来自UmbrellaException一起收集一组小孩Throwables。尝试这样:
In GWT 2.1.1 here comes UmbrellaException that collects a Set of child Throwables together. Try this:
public void onModuleLoad() {
GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
@Override
public void onUncaughtException(@NotNull Throwable e) {
ensureNotUmbrellaError(e);
}
});
}
其中 ensureNotUmbrellaError
定义如下:
private static void ensureNotUmbrellaError(@NotNull Throwable e) {
for (Throwable th : ((UmbrellaException) e).getCauses()) {
if (th instanceof UmbrellaException) {
ensureNotUmbrellaError(th);
} else {
th.printStackTrace();
}
}
}
这篇关于GWT客户端大小写在java中获取完整的错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文