NAME
Trickster::Exception - Exception handling for Trickster
SYNOPSIS
use Trickster::Exception;
# Throw an exception
Trickster::Exception::NotFound->throw(message => 'User not found');
# Catch and handle
eval {
# ... code that might throw
};
if (my $e = $@) {
if (ref($e) && $e->isa('Trickster::Exception')) {
return $res->json($e->as_hash, $e->status);
}
}
DESCRIPTION
Trickster::Exception provides structured exception handling with HTTP status codes and detailed error information.
EXCEPTION TYPES
Trickster::Exception::NotFound (404)
Trickster::Exception::BadRequest (400)
Trickster::Exception::Unauthorized (401)
Trickster::Exception::Forbidden (403)
Trickster::Exception::MethodNotAllowed (405)
Trickster::Exception::InternalServerError (500)