NAME
Class::ReluctantORM::Exception - OO Exceptions
SYNOPSIS
use Class::ReluctantORM::Exception;
# In API code:
# dies locally
Class::ReluctantORM::Exception::Params::Missing->throw(param => 'id');
# dies from caller's perspective
Class::ReluctantORM::Exception::Params::Missing->croak(param => 'id');
# dies from caller's caller's perspective
Class::ReluctantORM::Exception::Params::Missing->croak(param => 'id', frames => 2);
# To catch:
eval { something_dangerous(); }
if (my $e = Class::ReluctantORM::Exception::Params::Missing->caught()) {
my $p = $e->param(); # Find out what was missing
print $e; # Stringifies nicely
} else {
die $@; # Pass on unrecognized exceptions
}
# Special handler included for working with OmniTI::DB connections....
my $dbh = NatGeo::DB::Magazine->new();
$dbh->set_handle_error(Class::ReluctantORM::Exception->make_db_error_handler());
DESCRIPTION
Uses Exception::Class to define a wide variety of exceptions.
STRINGIFICATION
Any extra fields defined for a particular exception class will be included in the stringification of the exception, like this:
Error message
field1 => value1
field2 => value2
EXCEPTIONS
- Class::ReluctantORM::Exception::Param
-
Exceptions related to parameter passing. Expect fields 'param'.
- Class::ReluctantORM::Exception::Param::Missing
- Class::ReluctantORM::Exception::Param::Empty
-
An array or hash ref turned out to be present but empty.
- Class::ReluctantORM::Exception::Param::ExpectedHash
-
Thrown when the method uses named parameters, but an odd number of parameters were provided. param field is not used.
- Class::ReluctantORM::Exception::Param::ExpectedHashRef
- Class::ReluctantORM::Exception::Param::ExpectedArrayRef
- Class::ReluctantORM::Exception::Param::ExpectedHashref
- Class::ReluctantORM::Exception::Param::MutuallyExclusive
-
Used when two parameters cannot both be present. Use fields 'param' and 'other_param'.
- Class::ReluctantORM::Exception::Param::Duplicate
-
Thrown when the same named parameter is used more than once.
AUTHOR
Clinton Wolfe