1 package DBIx::Class::Exception;
4 use vars qw[@ISA $DBIC_EXCEPTION_CLASS];
5 use UNIVERSAL::require;
8 push( @ISA, $DBIC_EXCEPTION_CLASS || 'DBIx::Class::Exception::Base' );
11 package DBIx::Class::Exception::Base;
18 DBIx::Class::Exception - DBIC Exception Class
22 DBIx::Class::Exception->throw( qq/Fatal exception/ );
24 See also L<DBIx::Class>.
28 This is a generic Exception class for DBIx::Class. You can easily
29 replace this with any mechanism implementing 'throw' by setting
30 $DBix::Class::Exception::DBIC_EXCEPTION_CLASS
34 =head2 throw( $message )
36 =head2 throw( message => $message )
38 =head2 throw( error => $error )
40 Throws a fatal exception.
46 my %params = @_ == 1 ? ( error => $_[0] ) : @_;
48 my $message = $params{message} || $params{error} || $! || '';
50 local $Carp::CarpLevel = (caller(1) eq 'NEXT' ? 2 : 1);
52 Carp::croak($message);
57 Marcus Ramberg <mramberg@cpan.org>
61 Thanks to the L<Catalyst> framework, where this module was borrowed
66 This program is free software, you can redistribute it and/or modify
67 it under the same terms as Perl itself.