|
NAMEGantry::Exceptions - Structured exceptions for Gantry SYNOPSISThis module defines structured exceptions for Gantry. DESCRIPTIONThis module extends Exception::Class and defines a base set of exceptions for Gantry. You can extend this class with your own exceptions. When you do this, you will need to write an exception handler named exception_handler(). This method will recieve one parameter, which is the thrown exception. If an handler is not defined. A HTTP 500 error will be generated.
...
Gantry::Exception->throw(
status => 402,
status_line => 'payment required',
message => 'gimme all your money, and your luvin too...'
);
...
sub exception_handler {
my ($self, $X) = @_;
my $status = $X->status;
if ($status == 402) {
# do something useful
}
return $status;
}
Example:
Gantry::Exception::Redirect->throw('/login');
$self->relocate('/login');
Example:
Gantry::Exception::RedirectPermanently->throw('/somewhere');
$self->relocate_permanently('/somewhere');
SEE ALSOGantry Gantry::State::Exceptions Exception::Class AUTHORKevin L. Esteb <kesteb@wsipc.org> COPYRIGHT AND LICENSECopyright (C) 2008 Kevin L. Esteb This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
|