[dancer-users] Hooks throwing exceptions

David Precious davidp at preshweb.co.uk
Wed Apr 9 10:49:55 BST 2014


On Fri, 4 Apr 2014 16:53:58 +0100
David Cantrell <david at cantrell.org.uk> wrote:
> [...] I would like to
> have the 'before' hook just throw an exception object like the rest
> of my code. However, if I do, the 'on_route_exception' hook never
> triggers and the exception eventually just gets stringified which
> isn't very useful.
> 
> Is there some other hook I should be using instead of
> 'on_route_exception'?

I think on_handler_exception *should* do the job; I believe it's a
level higher than on_route_exception.

Failing that, before_error_init should fire when an error is being
handled, with a Dancer::Error object being passed to it.

Available hooks are documented at:

https://metacpan.org/pod/Dancer#hook
 
If all else fails, a feature request for an on_hook_exception handler
could make sense :)


-- 
David Precious ("bigpresh") <davidp at preshweb.co.uk>
http://www.preshweb.co.uk/     www.preshweb.co.uk/twitter
www.preshweb.co.uk/linkedin    www.preshweb.co.uk/facebook
www.preshweb.co.uk/cpan        www.preshweb.co.uk/github




More information about the dancer-users mailing list