Changed default match to use path instead of result
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Exception.pm
CommitLineData
a2f2cde9 1package Catalyst::Exception;
2
a2f2cde9 3use strict;
4use vars qw[@ISA $CATALYST_EXCEPTION_CLASS];
ebfde331 5use UNIVERSAL::require;
6
7BEGIN {
8 push( @ISA, $CATALYST_EXCEPTION_CLASS || 'Catalyst::Exception::Base' );
9}
a2f2cde9 10
11package Catalyst::Exception::Base;
12
13use strict;
14use Carp ();
15
16=head1 NAME
17
18Catalyst::Exception - Catalyst Exception Class
19
20=head1 SYNOPSIS
21
22 Catalyst::Exception->throw( qq/Fatal exception/ );
23
24See also L<Catalyst>.
25
26=head1 DESCRIPTION
27
28This is the Catalyst Exception class.
29
30=head1 METHODS
31
32=over 4
33
ebfde331 34=item throw( $message )
35
36=item throw( message => $message )
37
38=item throw( error => $error )
a2f2cde9 39
40Throws a fatal exception.
41
42=cut
43
44sub throw {
45 my $class = shift;
46 my %params = @_ == 1 ? ( error => $_[0] ) : @_;
47
48 my $message = $params{message} || $params{error} || $! || '';
49
50 local $Carp::CarpLevel = 1;
51
52 Carp::croak($message);
53}
54
55=back
56
57=head1 AUTHOR
58
59Sebastian Riedel, C<sri@cpan.org>
60Christian Hansen, C<ch@ngmedia.com>
61
62=head1 COPYRIGHT
63
64This program is free software, you can redistribute it and/or modify
65it under the same terms as Perl itself.
66
67=cut
68
691;