reverting back to when tests pass. applying changes one by one to find what failed
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Exception.pm
1 package Catalyst::Exception;
2
3 use strict;
4 use vars qw[@ISA $CATALYST_EXCEPTION_CLASS];
5
6 BEGIN {
7     push( @ISA, $CATALYST_EXCEPTION_CLASS || 'Catalyst::Exception::Base' );
8 }
9
10 package Catalyst::Exception::Base;
11
12 use strict;
13 use Carp ();
14
15 =head1 NAME
16
17 Catalyst::Exception - Catalyst Exception Class
18
19 =head1 SYNOPSIS
20
21    Catalyst::Exception->throw( qq/Fatal exception/ );
22
23 See also L<Catalyst>.
24
25 =head1 DESCRIPTION
26
27 This is the Catalyst Exception class.
28
29 =head1 METHODS
30
31 =head2 throw( $message )
32
33 =head2 throw( message => $message )
34
35 =head2 throw( error => $error )
36
37 Throws a fatal exception.
38
39 =cut
40
41 sub 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
52 =head1 AUTHOR
53
54 Sebastian Riedel, C<sri@cpan.org>
55 Christian Hansen, C<ch@ngmedia.com>
56
57 =head1 COPYRIGHT
58
59 This program is free software, you can redistribute it and/or modify
60 it under the same terms as Perl itself.
61
62 =cut
63
64 1;