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

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

danielbevenius
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
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-dev
qmx
Reply | Threaded
Open this post in threaded view
|

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

qmx
Administrator

On Oct 9, 2012, at 11:04 AM, Daniel Bevenius 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.
Awesome!

>
> 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.
The current state is exactly what I think it should be - from the most specific to the most generic

-- qmx


_______________________________________________
aerogear-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-dev
Reply | Threaded
Open this post in threaded view
|

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

Matthias Wessendorf
In reply to this post by danielbevenius
Great job!

thanks for the update!

-Matthias

On Tue, Oct 9, 2012 at 4:04 PM, Daniel Bevenius
<[hidden email]> 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
> [hidden email]
> 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
_______________________________________________
aerogear-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-dev