Exception handling with REST dispatch

56 views
Skip to first unread message

Jonas

unread,
Jun 22, 2015, 1:18:22 PM6/22/15
to gwt-pl...@googlegroups.com
I am migrating from RPC to REST Dispatch but I am unsure how to properly handle exceptions.

In RPC dispatch you would throw an ActionException (or subclass of) and in onFailure-method on client side check instanceof.

How is this done using REST dispatch? There is nothing in the documentation for REST dispatch and the Car Store project doesn't handle any exceptions in its *ResourceImpl-files.
I'm using Resource delegates approach similar to Car store. Anyone have some code examples to link to for this?

Thanks!

Maxime Mériouma-Caron

unread,
Jun 26, 2015, 10:07:21 AM6/26/15
to gwt-pl...@googlegroups.com
With REST, you pass the error state through HTTP status codes. You can pass a RestCallback instead of AsyncCallback when uaing the rest-dispatch. It has a setResppnse method which gives you access to the response (and it's status code).
Reply all
Reply to author
Forward
0 new messages