NAME

Twilio::Exceptions::RestExceptionV1 - An error from an API that follows API Standards V1

SYNOPSIS

use Scalar::Util qw(blessed);

my $ok = eval { $list->create($name); 1 };
if (!$ok) {
  my $error = $@;
  die $error unless blessed($error) && $error->isa('Twilio::Exceptions::RestExceptionV1');
  warn 'Check the request' if $error->get_user_error;
}

DESCRIPTION

The newer Twilio APIs describe errors with httpStatusCode, params and userError. This class inherits from Twilio::Exceptions::RestException, so code that catches that class catches this one too.

METHODS

new

my $error = Twilio::Exceptions::RestExceptionV1->new(
  $code, $message, $http_status_code, \%params, $user_error
);

get_http_status_code

Returns the HTTP status, as get_status_code does.

get_params

Returns a hash reference with the details Twilio gave.

get_user_error

Returns 1 when Twilio says the caller made the mistake, and 0 otherwise.

LICENSE

Copyright (c) 2026 Francisco Zarabozo. Released under the MIT License.