X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FException.pm;h=75064830f360abb46d90d78e3c109b9f7a50f24b;hp=ade1a46b8e7abb4c7df94a38ce032c7862a125a9;hb=163b3de6693e8c44dbe24cfc79cc3cf300610ed8;hpb=ebfde331f96f61128105df0b2c4904cc0d5593e5 diff --git a/lib/Catalyst/Exception.pm b/lib/Catalyst/Exception.pm index ade1a46..7506483 100644 --- a/lib/Catalyst/Exception.pm +++ b/lib/Catalyst/Exception.pm @@ -1,17 +1,6 @@ package Catalyst::Exception; -use strict; -use vars qw[@ISA $CATALYST_EXCEPTION_CLASS]; -use UNIVERSAL::require; - -BEGIN { - push( @ISA, $CATALYST_EXCEPTION_CLASS || 'Catalyst::Exception::Base' ); -} - -package Catalyst::Exception::Base; - -use strict; -use Carp (); +# XXX: See bottom of file for Exception implementation =head1 NAME @@ -29,41 +18,53 @@ This is the Catalyst Exception class. =head1 METHODS -=over 4 - -=item throw( $message ) +=head2 throw( $message ) -=item throw( message => $message ) +=head2 throw( message => $message ) -=item throw( error => $error ) +=head2 throw( error => $error ) Throws a fatal exception. +=head2 meta + +Provided by Moose + +=head1 AUTHORS + +Catalyst Contributors, see Catalyst.pm + +=head1 COPYRIGHT + +This library is free software. You can redistribute it and/or modify +it under the same terms as Perl itself. + =cut -sub throw { - my $class = shift; - my %params = @_ == 1 ? ( error => $_[0] ) : @_; +{ + package Catalyst::Exception::Base; - my $message = $params{message} || $params{error} || $! || ''; + use Moose; + use namespace::clean -except => 'meta'; - local $Carp::CarpLevel = 1; + with 'Catalyst::Exception::Basic'; - Carp::croak($message); + __PACKAGE__->meta->make_immutable; } -=back +{ + package Catalyst::Exception; -=head1 AUTHOR + use Moose; + use namespace::clean -except => 'meta'; -Sebastian Riedel, C -Christian Hansen, C + use vars qw[$CATALYST_EXCEPTION_CLASS]; -=head1 COPYRIGHT + BEGIN { + extends($CATALYST_EXCEPTION_CLASS || 'Catalyst::Exception::Base'); + } -This program is free software, you can redistribute it and/or modify -it under the same terms as Perl itself. - -=cut + __PACKAGE__->meta->make_immutable; +} 1;