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