开发者

DWR Exception Handling

开发者 https://www.devze.com 2023-01-11 12:51 出处:网络
I\'m trying to capture and handle the return of a NullPointerException in my DWR method call: CompaniesByCountyFactory.getElementCompanies(command, countyId, stateId, {

I'm trying to capture and handle the return of a NullPointerException in my DWR method call:

CompaniesByCountyFactory.getElementCompanies(command, countyId, stateId, {
callback:popupDisplay,
errorHandler:function(message){jQuery("<span>errorHandler::"+message+"</span>").dialog();},
exception开发者_StackOverflow社区Handler:function(errorString, exception){jQuery("
<span>exceptionHandler::"+errorString+"</span>").dialog();}
 });

Now the code path I'm testing causes getElementCompanies to throw a null pointer exception. This method is only called by DWR and is how I'm trying to communicate that the user must be logged out.

The problem stands in that neither my errorHandler or my exceptionHandler are ever being called.

DWR seems to see the exception and then automatically issue an alert() of the exception error string and I cannot figure out how to override this behavior.

Any ideas what I'm doing wrong?

Thanks


I don't see anything glaringly wrong with this, assuming you're using DWR 2.0+.

If you're using DWR 1, you'll need to use:

dwr.engine.setErrorHandler(handler);

I tried your code, just made the callbacks simpler without using jQuery, and it works fine here (using DWR 2.0.5).

I'm sure you've already seen it, but if not:

http://directwebremoting.org/dwr/documentation/browser/errors.html

0

精彩评论

暂无评论...
验证码 换一张
取 消