【发布时间】:2012-07-17 20:20:54
【问题描述】:
我在本地方法中有一些逻辑,它返回 sth 或 null - 它们都是有效且有意义的状态,我想在方法失败时抛出异常。由于它是原生 JSNI,我不知道该怎么做。
所以考虑方法:
public final native <T> T myNativeMethod() /*-{
//..some code
//in javascript you can throw anything, not only the exception object:
throw "something";
}-*/;
但是如何捕捉抛出的物体?
void test() {
try {
myNativeMethod();
}
catch(Throwable e) { // what to catch here???
}
}
是否有任何特殊的 Gwt 异常类型包装了从 JSNI 抛出的“异常对象”?
【问题讨论】:
标签: java javascript exception gwt jsni