D1 throwing strings, not always Dancer::Exceptions
17 Oct
2017
17 Oct
'17
1:38 a.m.
I just needed to hook on_handler_exception in a D1 app for the first time, and was surprised to find that it doesn’t obey [the docs][1]: hook on_handler_exception => sub { # The docs say we're passed a Dancer::Exception object, but that is # not true: we are sometimes passed a plain string! my $exception = shift; my $msg = ref($exception) ? $exception->message() : "STR[$exception]"; ... Simple test case: drop this into a route while Perl strict mode is enabled: debug 'This will throw an error ' . undef; You will get the STR[message] form above. [1]: https://metacpan.org/pod/Dancer#hook
2943
Age (days ago)
2943
Last active (days ago)
0 comments
1 participants
participants (1)
-
Warren Young