GWT Interop:获得完整的堆栈跟踪

时间:2017-11-05 23:57:33

标签: java gwt gwt-jsinterop

给定使用JSInterop定义的以下简单Java类:

@JsType(name = "ExceptionTest", namespace = JsPackage.GLOBAL)
public class ExceptionTest {

   public static void triggerTypeErrorWhenNull(Object object) {

      object.toString();
   }
}

在JavaScript中调用如下:

setTimeout(function timerTrigger() {
  function test1() {
    ExceptionTest.triggerTypeErrorWhenNull(null);
  }

  test1();
}, 100);

发生异常时会发出以下堆栈跟踪:

Uncaught TypeError: Cannot read property 'toString' of null
  at toString_0 (local-0.js:76)
  at Function.triggerTypeErrorWhenNull (local-0.js:1319)

我的问题是如何为发生的错误获取完整的堆栈跟踪;这是一个堆栈跟踪,包括在JavaScript中调用JSInterop方法的位置(test1())。

此处是项目的链接,其中包含示例的完整源代码:ExceptionTest.java

0 个答案:

没有答案