NAME
Handel::Exception - Exceptions used within Handel
SYNOPSIS
use
Handel::Cart;
try
{
my
$cart
= Handel::Cart->new(
'junk crap'
);
}
catch
Handel::Exception::Argument
with
{
'Passed the wrong arguments to method'
;
}
catch
Handel::Exception
with
{
'Unknown issue with Handel'
;
}
catch
Error
with
{
'Unhandled exception'
;
} otherwise {
'aliens ate my exception'
;
};
DESCRIPTION
Handel::Exception subclasses Error and attempts to throw exceptions when unexpected things happen.
EXCEPTIONS
Handel::Exception
This is the base exception thrown in Handel
. All other exceptions subclass Handel::Exception
so it's possible to catch all Handel generated exceptions with a single catch
statement.
try
{
...
}
catch
Handel::Exception
with
{
my
$E
=
shift
;
'Something bad happened in Handel: '
. E->text;
}
catch
MyApplicationException
with
{
'Something bad happened in MyApplication'
;
};
See Error for more information on how to use exceptions.
Handel::Exception::Constraint
This exception is thrown if a database constraint is violated. This is true for both raw DBI database constraint errors as well as field updates that don't pass constraints in Handel::Components::Constraints.
Handel::Exception::Validation
This exception is thrown if the validation performed by Handel::Components::Validation has failed. If the validation component returned a result object, that can be found in $E->results.
Handel::Exception::Storage
This exception is thrown if there are any configuration or setup errors in Handel::Storage.
Handel::Exception::Argument
This exception is thrown when an invalid or unexpected argument value is passed into methods.
Handel::Exception::Taglib
This exception is thrown when an unexpected error occurs within the AxKit taglibs.
METHODS
new
This returns a new Handel::Exception object. This is mostly used internally by Error. In most circumstances, you don't need to call new
at all. Instead, simply use the throw
syntax:
use
Handel::Exceptions;
throw Handel::Exception::Taglib(
-text
=> translate(
"Tag '[_1]' not valid inside of other Handel tags"
,
$tag
)
)
if
(
$context
[
$#context
] ne
'root'
);
details
Returns the details portion of the exception message if there are any.
results
Returns the data validation result errors from exceptions thrown by Handel::Components::Validation.