GWT client umbrellaexception get full error message in java

后端 未结 1 796
鱼传尺愫
鱼传尺愫 2021-01-07 00:29

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 dev

相关标签:
1条回答
  • 2021-01-07 01:18

    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);
        }
      });
    }
    

    Where ensureNotUmbrellaError is defined as follows:

    private static void ensureNotUmbrellaError(@NotNull Throwable e) {
      for (Throwable th : ((UmbrellaException) e).getCauses()) {
        if (th instanceof UmbrellaException) {
          ensureNotUmbrellaError(th);
        } else {
          th.printStackTrace();
        }
      }
    }
    
    0 讨论(0)
提交回复
热议问题