From: Florian Ragwitz Date: Fri, 26 Jun 2009 15:27:19 +0000 (+0000) Subject: Make Catalyst::Exception throw exception instances instead of plain strings. X-Git-Tag: 5.80006~32 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6054110cb6dde47a4f72b4bae830ad663c7ea292;p=catagits%2FCatalyst-Runtime.git Make Catalyst::Exception throw exception instances instead of plain strings. --- diff --git a/lib/Catalyst/Exception.pm b/lib/Catalyst/Exception.pm index 4959e42..0ee0fa0 100644 --- a/lib/Catalyst/Exception.pm +++ b/lib/Catalyst/Exception.pm @@ -50,11 +50,12 @@ sub throw { my $class = shift; my %params = @_ == 1 ? ( error => $_[0] ) : @_; - my $message = $params{message} || $params{error} || $! || ''; + $params{message} = $params{message} || $params{error} || $! || ''; + my $error = $class->new(%params); local $Carp::CarpLevel = 1; - croak($message); + croak($error); } =head2 meta