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
36 =item throw( $message )
38 =item throw( message => $message )
40 =item throw( error => $error )
42 Throws a fatal exception.
48 my %params = @_ == 1 ? ( error => $_[0] ) : @_;
50 my $message = $params{message} || $params{error} || $! || '';
52 local $Carp::CarpLevel = (caller(1) eq 'NEXT' ? 2 : 1);
54 Carp::croak($message);
61 Marcus Ramberg <mramberg@cpan.org>
65 Thanks to the L<Catalyst> framework, where this module was borrowed
70 This program is free software, you can redistribute it and/or modify
71 it under the same terms as Perl itself.