NAME
Cloudflare::API::Error - exception for a failed Cloudflare JSON response
SYNOPSIS
my $result=eval { $api->zones()->get($zone_id) };
if (my $error=$@) {
if (ref($error) && $error->isa('Cloudflare::API::Error')) {
warn $error->as_string();
my $details=$error->errors();
}
}
DESCRIPTION
Cloudflare::API throws this exception when the HTTP request succeeds but the decoded JSON envelope contains success: false. HTTP and transport failures instead throw HTTP::API::Core::Error. The error object retains the original response and Cloudflare's error and message arrays.
METHODS
new(%fields) — Construct an exception object from
response,errors, andmessages. This is normally called byCloudflare::API; it returns aCloudflare::API::Errorobject.response() — Return the original
HTTP::API::Core::Responseobject, orundefif one was not supplied.errors() — Return Cloudflare's
errorsvalue, or an empty array reference if absent or false.messages() — Return Cloudflare's
messagesvalue, or an empty array reference if absent or false.as_string() — Join non-empty
messagefields from hash entries inerrorswith semicolons. If none are present, returnCloudflare API reported failure. Stringification invokes this method automatically.
SEE ALSO
Cloudflare::API, HTTP::API::Core::Error
AUTHOR
Andrew Speer mailto:andrew.speer@isolutions.com.au
LICENSE and COPYRIGHT
Copyright (c) 2026 Andrew Speer. This software is free software under the same terms as Perl 5.