RequestFactory:error.getExceptionType()在Receiver#onFailure中返回null [英] RequestFactory: error.getExceptionType() returns null in Receiver#onFailure
问题描述
pre $
public void throwException()throws Exception {
throw new NullPointerException( fslkdjflks);
}
在客户端我有:
_requestFactory.myService()。throwException()。fire(new Receiver< Void>(){
@Override
public void onSuccess(void response){
// TODO自动生成的方法存根
}
@覆盖
public void onFailure(ServerFailure error){
// TODO自动生成的方法存根
Window.alert(error.getExceptionType()++ error.getMessage());
}
});
error.getExceptionType()返回null而不是异常的类型。任何想法为什么?
谢谢,
Gilad。
默认 ExceptionHandler
( DefaultExeptionHandler
)填充 exceptionType
和 stackTraceString
。如果你想要它们,你必须通过 ExceptionHandler /com/google/web/bindery/requestfactory/server/RequestFactoryServlet.html#RequestFactoryServlet%28com.google.web.bindery.requestfactory.server.ExceptionHandler,%20com.google.web.bindery.requestfactory.server.ServiceLayerDecorator ... %29rel =noreferrer>扩展 RequestFactoryServlet
。
In the server side i have:
public void throwException() throws Exception {
throw new NullPointerException("fslkdjflks");
}
in the client side i have:
_requestFactory.myService().throwException().fire(new Receiver<Void>() {
@Override
public void onSuccess(Void response) {
// TODO Auto-generated method stub
}
@Override
public void onFailure(ServerFailure error) {
// TODO Auto-generated method stub
Window.alert(error.getExceptionType() + " " + error.getMessage());
}
});
error.getExceptionType() returns null and not the type of the exception. Any idea why?
Thanks, Gilad.
The default ExceptionHandler
(DefaultExeptionHandler
) does not populate the exceptionType
and stackTraceString
. If you want them, you have to provide your own ExceptionHandler
by extending RequestFactoryServlet
.
这篇关于RequestFactory:error.getExceptionType()在Receiver#onFailure中返回null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!