NAME
CatalystX::Utils::HttpException - A basic way to throw exceptions
SYNOPSIS
use CatalystX::Utils::HttpException 'throw_http';
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
package MyApp::Exception::Custom;
use Moose;
extends 'CatalystX::Utils::HttpException';
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.