PerlDancer/Dancer2 — pull request #113 by yanick (2012-11-03 16:26:50+00:00)
Title: Major Dancer::Core::Error rework

The main point of the patch is to incorporate Dancer::Core::Error
more with the rest of the system. And that means, amongst
other things, have the Dispatcher use it directly when things
go wrong.

Major points:

D::C::Error can be called either via

$response->error( %args );

or via

my $resp = Dancer::Core::Error->new( ... )->throw;

To create the content of the response, D::C::Error will first
look if there's a template named, e.g., 404.tt. If not, it'll look
for a static page 404.html. If there is none, it'll fall back
to a default internal template.

To accomodate the dsl function 'send_error()', if a route is passed
a Response object, it'll use it verbatim. So now you can do

get '/stuff' => sub {
Dancer::Core::Response->new( ... );
}