[aerogear-dev] 0.0.4.M6 Snapshot - Error Handling & Controller

Matthias Wessendorf matzew at apache.org
Tue Oct 9 10:36:25 EDT 2012


Great job!

thanks for the update!

-Matthias

On Tue, Oct 9, 2012 at 4:04 PM, Daniel Bevenius
<daniel.bevenius at gmail.com> wrote:
> Hi everyone!
>
> We have pushed https://issues.jboss.org/browse/AEROGEAR-426, which
> means that you are now able to specify error routes to handle
> exceptions.
>
> For example, you can now specify an error route as follows:
> route()
>           .on(AeroGearSecurityException.class)
>           .to(Error.class).security();
> If any of the routes following throws an AeroGearSecurityException,
> the above error route will be used to handle it. You can specify as
> many exceptions like the one above as you like.
>
> You can also specify multiple exceptions in the on() method, which
> will all be handled by the same error route:
> route()
>           .on(CustomException.class, OtherException.class)
>           .to(Error.class).log();
>
> If you want a general error route for all of your routes, you can
> specify one like this:
> route()
>           .on(CustomException.class, OtherException.class)
>           .to(Error.class).log();
> route()
>           .on(Exception.class)
>           .to(Error.class).index();
>
> At the moment this order might not be intuitive (I'm to blame for
> this) and there is JIRA (https://issues.jboss.org/browse/AEROGEAR-522)
> that suggest that the more general exception should be at the top.
>
> Lastly, if you don't specify any error route, a default one will used.
> We are currently working on making this as attractive as possible but
> at the moment it is very basic.
>
> For a real code example:
> https://github.com/aerogear/aerogear-controller-demo/blob/master/src/main/java/org/jboss/aerogear/controller/demo/Routes.java#L42
>
> Try it out:
> https://github.com/aerogear/aerogear-controller-demo
> http://errorroutes-danbev.rhcloud.com/aerogear-controller-demo/
>
> What's missing?
> - As mentioned the order of error routes should probably be reversed
> (https://issues.jboss.org/browse/AEROGEAR-522)
> - Currently only GET request are supported
> (https://issues.jboss.org/browse/AEROGEAR-523)
> - Support for REST clients (https://issues.jboss.org/browse/AEROGEAR-515)
> - Default error page
> - Support for returning a different exception then the one that is
> thrown inside of the route
> (https://issues.jboss.org/browse/AEROGEAR-527)
> _______________________________________________
> aerogear-dev mailing list
> aerogear-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/aerogear-dev



-- 
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf


More information about the aerogear-dev mailing list