From: John Napiorkowski Date: Tue, 19 Jul 2016 20:47:04 +0000 (-0500) Subject: make sure we are explicit in the return X-Git-Tag: 5.90110~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=ef52d28f14574311a08012a742a704c36fd1cc28 make sure we are explicit in the return --- diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 24674b9..f3e5525 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -3572,8 +3572,8 @@ sub setup_encoding { =head2 handle_unicode_encoding_exception Hook to let you customize how encoding errors are handled. By default -we just throw an exception. Receives a hashref of debug information. -Example of call: +we just throw an exception and the default error page will pick it up. +Receives a hashref of debug information. Example of call: $c->handle_unicode_encoding_exception({ param_value => $value, @@ -3598,6 +3598,11 @@ in your application: return 1; } +NOTE: Please keep in mind that once an error like this occurs, the request +setup is aborted, which means the state of C<$c> and related context parts like +the request and response may not be setup up correctly (since we never finished the +setup. + =cut sub handle_unicode_encoding_exception { @@ -3647,7 +3652,7 @@ sub _handle_param_unicode_decoding { $enc->decode( $value, $check); } catch { - $self->handle_unicode_encoding_exception({ + return $self->handle_unicode_encoding_exception({ param_value => $value, error_msg => $_, encoding_step => 'params', diff --git a/t/utf_incoming.t b/t/utf_incoming.t index 8b88a0e..5293951 100644 --- a/t/utf_incoming.t +++ b/t/utf_incoming.t @@ -558,10 +558,8 @@ SKIP: { my $res = request $req; is ($res->code, '400', "Invalid get param is 400") or diag Dumper($res->decoded_content); } - } - ## should we use binmode on filehandles to force the encoding...? ## Not sure what else to do with multipart here, if docs are enough...