Browse Source

Remove render of template from unknown exception

Rendering a template for an error outside of the route results in
Dancer2 throwing its own warning.  The on_route_exception hook used
to be the place to coerce the exception into a specific response.
At some point this changed and no longer works as I expected.

Instead, we're just going to log the exception to make sure we're
aware internally, then let Dancer2 handle rendering the 500.tt
view on it's own.  This app doesn't have any information to
propagate to the user here anyway.
master
Blaine Motsinger 5 months ago
parent
commit
d51405442d
  1. 7
      lib/Pasteburn.pm
  2. 10
      views/500.tt

7
lib/Pasteburn.pm

@ -59,14 +59,7 @@ hook on_route_exception => sub {
my $app = shift;
my $exception = shift;
my $template_params = {
route => request->path,
message => 'Whoops, there was an error on our end',
};
log( 'error', $exception );
response->{status} = HTTP::Status::HTTP_INTERNAL_SERVER_ERROR;
return template error => $template_params;
};
1;

10
views/500.tt

@ -0,0 +1,10 @@
[% INCLUDE includes/header.tt
title = 'Error'
%]
<h2>Error</h2>
<p>
Whoops, something went wrong on our end.
</p>
[% INCLUDE includes/footer.tt %]
Loading…
Cancel
Save