NAME
PayProp::API::Public::Client::Exception::Base - Base module for exceptions.
SYNOPSIS
{
package PayProp::API::Public::Client::Exception::Custom;
use parent qw/ PayProp::API::Public::Client::Exception::Base /;
# Optional error class to construct C<errors> field.
sub error_class { 'PayProp::API::Public::Client::Error::Custom' }
# Optional error fields as defined in C<PayProp::API::Public::Client::Error::Custom>
sub error_fields { qw/ custom_field_1 / }
1;
}
PayProp::API::Public::Client::Exception::Custom->throw(
status_code => 500,
errors => [
{ custom_field_1 => 'Hello' },
],
);
DESCRIPTION
*DO NOT INSTANTIATE THIS MODULE DIRECTLY*
This is a base exception module from which specific exceptions are extended. For new exception
types use this module as a parent.
See C<PayProp::API::Public::Client::Exception::*> for examples.
METHODS
error_class
Can be optionally overridden in C<PayProp::API::Public::Client::Exception::*>.
error_fields
Can be optionally overridden in C<PayProp::API::Public::Client::Exception::*>.
throw
Main method to call to throw an exception from C<PayProp::API::Public::Client::Exception::*>.
my $Exception = PayProp::API::Public::Client::Exception::Custom->throw('I am an exception!');
or
my $Exception = PayProp::API::Public::Client::Exception::Custom->throw(
status_code => 500,
errors => [
{ custom_field_1 => 'Hello' },
],
);
errors
Return instances of C<PayProp::API::Public::Client::Error::*>, if defined.
my $errors = PayProp::API::Public::Client::Exception::Custom->errors;
status_code
Return exception status code, if defined.
my $status_code = PayProp::API::Public::Client::Exception::Custom->status_code;
Fields
To be extended for additional fields to be available on C<PayProp::API::Public::Client::Exception::*>.
to_hashref
Convert C<PayProp::API::Public::Client::Exception::*> to hashref, in place for easier debugging.
my $error_ref = PayProp::API::Public::Client::Exception::Custom->to_hashref;
AUTHOR
Yanga Kandeni E<lt>yangak@cpan.orgE<gt>
Valters Skrupskis E<lt>malishew@cpan.orgE<gt>
COPYRIGHT
Copyright 2023- PayProp
LICENSE
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
If you would like to contribute documentation
or file a bug report then please raise an issue / pull request:
L<https://github.com/Humanstate/api-client-public-module>