vert-x3 / vertx-lang-ruby

Vert.x Ruby support
Apache License 2.0
14 stars 12 forks source link

route.failure_handler does not receive the raised Exception #28

Open sziep opened 7 years ago

sziep commented 7 years ago

Hi,

Im not sure if I do this correct. I cannot get error handling to work in my app. All specific Exceptions are replaced by RuntimeExceptions, which in most cases don't provide useful details anymore like proper call stacks.

I think the reason is here: http://vertx.io/docs/yardoc/VertxWeb/RoutingContext.html#fail-instance_method

Every Exception passed to "fail" is converted into a Throwable via Vertx::Util::Utils.to_throwable. This essentially creates a Proc which re-raises the exception and catches it again (utils.rb) (Helper.java) . IMO this would make sense if I pass a string to the "fail" method. But when I pass an exception it should not do this.

This makes proper exception handling nearly impossible. Sorry, I'm unable to provide a Pull Request. I dont know where to start. :/ Is this ruby wrapper code somehow generated?

Im running a vertx 3.3.2 app on JRuby 9.1

Best -Stephan