1 package Catalyst::Exception;
3 # XXX: See bottom of file for Exception implementation
5 package Catalyst::Exception::Base;
9 use namespace::clean -except => 'meta';
13 Catalyst::Exception - Catalyst Exception Class
17 Catalyst::Exception->throw( qq/Fatal exception/ );
23 This is the Catalyst Exception class.
27 =head2 throw( $message )
29 =head2 throw( message => $message )
31 =head2 throw( error => $error )
33 Throws a fatal exception.
40 default => sub { $! || '' },
49 return $self->message;
52 around BUILDARGS => sub {
53 my ($next, $class, @args) = @_;
54 if (@args == 1 && !ref $args[0]) {
55 @args = (message => $args[0]);
58 my $args = $class->$next(@args);
59 $args->{message} ||= $args->{error}
60 if exists $args->{error};
67 my $error = $class->new(@_);
68 local $Carp::CarpLevel = 1;
83 Catalyst Contributors, see Catalyst.pm
87 This library is free software. You can redistribute it and/or modify
88 it under the same terms as Perl itself.
92 Catalyst::Exception::Base->meta->make_immutable;
94 package Catalyst::Exception;
97 use namespace::clean -except => 'meta';
99 use vars qw[$CATALYST_EXCEPTION_CLASS];
102 extends($CATALYST_EXCEPTION_CLASS || 'Catalyst::Exception::Base');
105 __PACKAGE__->meta->make_immutable;