In that case I would wrap the exception with a try/catch block.
The question is: Where should you do that?
Well, DWR has a Filter mechanism which is much like filters in Java Servlet API.
You could write something like this:
public class ExceptionFilter implements org.directwebremoting.AjaxFilter {
public Object doFilter(Object obj, Method method, Object[] params, AjaxFilterChain chain) throws Exception {
Object res;
try{
res = chain.doFilter(obj, method, params);
} catch(Exception e){
// throw your Exception with no "extra" data
throw new RuntimeException();
}
return res;
}
}
You may need to do some configuration in the dwr.xml file (which I leave to your reading: http://directwebremoting.org/dwr/documentation/server/configuration/dwrxml/filters.html)
(edit 1)
Some more explanation:
What this does is intercept the DWR remote call and forward the call on to the execution chain. What I added to that call (chain.doFilter) is a try/catch block; In case your code should throw any exception, it will end up in the catch block and then its up to you what to do next.
I hope this will help you :]