NAME

Apertur::SDK::Error - Base exception class for Apertur API errors

SYNOPSIS

use Apertur::SDK::Error;

eval {
    Apertur::SDK::Error->throw(
        status_code => 500,
        code        => 'INTERNAL',
        message     => 'Something went wrong',
    );
};
if (my $err = $@) {
    if (ref $err && $err->isa('Apertur::SDK::Error')) {
        warn "API error: " . $err->message;
    }
}

DESCRIPTION

Base error class for all Apertur SDK errors. All API errors are represented as blessed objects that can be thrown with die and caught with eval.

METHODS

new(%args)

Constructor. Accepted keys: status_code, code, message.

throw(%args)

Class method that creates and throws (via die) a new error.

status_code

Returns the HTTP status code.

code

Returns the error code string (e.g. NOT_FOUND).

message

Returns the human-readable error message.