BriteSnow / snow

A Lightweight, Google Guice, Simple, and Powerful Web Application Framework that makes building modern Web Application a breeze! Fully open source, Apache V2 licensed.
http://britesnow.com/snow
29 stars 10 forks source link

Thrown exception in WebActionHandler does not get caught by WebExceptionCatcher #2

Closed rbanikaz closed 12 years ago

rbanikaz commented 12 years ago

When I throw a particular exception in a WebActionHandler, it should get caught by the WebExceptionCatcher, but it is not.

The reason is because :

  1. The exception is wrapped inside an invocationTargetException because the WebActionHandler is invoked via reflection
  2. Even then, the exception get's muffled inside the catch block on line # 212 of WebController.java: https://github.com/BriteSnow/snow/blob/master/src/main/java/com/britesnow/snow/web/WebController.java#L212

I think you either need to throw the excpetion on that line so it will get caught in the catch on line #235, OR need to use the application.processWebExceptionCatcher method right away.

This is no a huge blocker for me but I would like to know if / when it gets resolved...

Thanks

rbanikaz commented 12 years ago

Any updates?

rbanikaz commented 12 years ago

Hi Jeremy:

This is actually becoming higher priority for me now as I have to manually catch the exceptions in the WebActionHandlers and am not able to rely on the WebExceptionCatchers to work. Can you please help me with this?

Thanks, Reza

jeremychone commented 12 years ago

Sorry for the delay. Make sense, I will look at it and fix it, and deploy it as a 1.9.9-snapshot

jeremychone commented 12 years ago

This should be fixed in the current master (i.e. 1.9.9-SNAPSHOT)

    <dependency>
        <groupId>com.britesnow</groupId>
        <artifactId>snow</artifactId>
        <version>1.9.9-SNAPSHOT</version>
    </dependency>
rbanikaz commented 12 years ago

Bug is still there. Raised Pull Request with unit test case to reproduce the error. When the request type is POST, we expect that the WebExceptionCatcher should getr called, however looks like it is not the case.

jeremychone commented 12 years ago

Ok, this was fixed now with the latest commit. It was deployed in the maven central with 1.9.9-snapshot