NAME
Claude::Agent::Error - Exception classes for Claude Agent SDK
SYNOPSIS
use Claude::Agent::Error;
eval {
...
};
if (my $err = $@) {
if (ref $err && $err->isa('Claude::Agent::Error::CLINotFound')) {
die "Please install Claude CLI first";
}
die $err;
}
DESCRIPTION
This module provides the exception classes thrown by the Claude Agent SDK. Every error stringifies to Type: message, where the type is the class name without the Claude::Agent::Error:: prefix.
Loading this module loads every subclass listed below.
ERROR CLASSES
Claude::Agent::Error::CLINotFound - CLI not found
Claude::Agent::Error::ProcessError - Process execution failed
Claude::Agent::Error::JSONDecodeError - JSON parsing failed
Claude::Agent::Error::TimeoutError - Operation timed out
Claude::Agent::Error::PermissionDenied - Permission denied
Claude::Agent::Error::HookError - Hook execution failed
ATTRIBUTES
message
The error description. Required.
METHODS
new
my $err = Claude::Agent::Error->new(message => 'something failed');
Takes a flat list of name/value pairs. Unknown names are ignored.
throw
Claude::Agent::Error->throw(message => 'something failed');
Constructs the error and dies with it.
to_string
my $text = $err->to_string;
Returns Type: message. The "" operator is overloaded to call it.
AUTHOR
LNATION, <email at lnation.org>
LICENSE
This software is Copyright (c) 2026 by LNATION.
This is free software, licensed under The Artistic License 2.0 (GPL Compatible).