Skip to content

Commit

Permalink
Merge pull request #6 from genehack/fix-handle_exception
Browse files Browse the repository at this point in the history
Fix handle_exception to rethrow instead of return. [#5]
  • Loading branch information
doy committed Jan 17, 2015
2 parents 8a861a3 + fda63a7 commit 9f1bc6a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 5 additions & 0 deletions Changes
@@ -1,6 +1,11 @@
Revision history for Plack-App-Path-Router

{{$NEXT}}

- Change 'handle_exception' so that it rethrows exception by
default, rather than returning it.

0.07 2015-01-13
- Add 'handle_exception' method to
Plack::App::Path::Router::Custom, to provide more granular
control over response handling. (John Anderson)
Expand Down
7 changes: 3 additions & 4 deletions lib/Plack/App/Path/Router/Custom.pm
Expand Up @@ -164,16 +164,15 @@ has handle_response => (
=attr handle_exception
Coderef which takes an exception thrown by the processing of the request and
returns a valid PSGI response. Defaults to just turning the caught
exception. B<NOTE:> this coderef should B<return> the exception or modified
response. Rethrowing the caught exception will produce undesired results.
returns a valid PSGI response. Defaults to just rethrowing the caught
exception.
=cut

has handle_exception => (
traits => ['Code'],
isa => 'CodeRef',
default => sub { sub { $_[0] } },
default => sub { sub { die $_[0] } },
handles => {
handle_exception => 'execute' ,
},
Expand Down

0 comments on commit 9f1bc6a

Please sign in to comment.