Friday, April 1, 2011

Re: how to return errors from RequestFactoryServlet?

u can extends requestfactoryservlet to use your exceptionhandler (which creates ServerFailure), (dont forget to put it in web.xml instead of the default requestfactoryservlet)
when u throw exception on server, onFailure will be called, not exactly Exception/Throwable thou.

there's a post about it in this forum already, just try to search.


On Fri, Apr 1, 2011 at 5:45 AM, KaffeineComa <kaffeinecoma@gmail.com> wrote:
Like the asker of this question:


I'd like to be able to return errors to the front-end when RequestFactoryServlet encounters a problem.  Thrown exceptions never seem to result in onFailure() or onViolation() being called. Instead, onSuccess() is called despite the failure.

I also tried setting res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), but that just results in java.lang.IllegalStateException, presumably because super.doPost() has already written to the response. (You might wonder why I'm running code after super.doPost()- it's because I'm committing and closing my EntityManager.) 

What must I do to propagate errors to the front-end? Is there some Exception subclass I should throw?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment