NAME
Net::Blossom::Error - Blossom HTTP error object
SYNOPSIS
my $error = eval { $client->get_blob($sha256); 1 } ? undef : $@;
if (ref($error) && $error->isa('Net::Blossom::Error')) {
warn $error->status;
warn "$error";
}
DESCRIPTION
Net::Blossom::Error represents a non-success HTTP response from a Blossom server. Net::Blossom::Client dies with this object for non-402 HTTP failures.
The object stringifies to a compact diagnostic containing status, reason, optional X-Reason, method, and URL.
CONSTRUCTOR
new
my $error = Net::Blossom::Error->new(%args);
Required arguments are method, url, status, and reason. status must be a three-digit HTTP status code from 100 through 599.
Optional x_reason is the server's X-Reason diagnostic. Optional headers defaults to an empty hash reference. Optional body defaults to the empty string.
Unknown arguments or invalid values croak.
ACCESSORS
method
Returns the HTTP method.
url
Returns the request URL.
status
Returns the HTTP status code.
reason
Returns the HTTP reason phrase.
x_reason
Returns the optional X-Reason diagnostic.
headers
Returns the response headers hash reference.
body
Returns the response body.
METHODS
as_string
my $message = $error->as_string;
Returns the same diagnostic used by stringification.