From Code to Community: Sponsoring The Perl and Raku Conference 2025 Learn more

NAME

CatalystX::Utils::HttpException - A basic way to throw exceptions

SYNOPSIS

throw_http $code, %extra;
## OR ##
CatalystX::Utils::HttpException->throw(500, %extra);
## OR Subclass for your use case (although just consuming the role 'CatalystX::Utils::DoesHttpException'
## is probably cleaner
use Moose;
sub status_code { 418 }
sub error { 'Coffee not allowed' }

DESCRIPTION

If you need to throw an exception from code called by Catalyst, such as code deep inside your DBIx::Class classes and you want to signal how to handle the issue you an use this. You can also use this to subclass your own custom messages that will get properly handled in a web context.

This class is semi deprecated (not recommended anymore for creating custom exception classes and you should use the role CatalystX::Utils::DoesHttpException which this consumes directly.

SEE ALSO

CatalystX::Errors.

AUTHOR

CatalystX::Errors.

COPYRIGHT & LICENSE

CatalystX::Errors.