NAME

Business::GoCardless::Exception

DESCRIPTION

Exception handling for the Business::GoCardless modules, uses the Throwable module.

ATTRIBUTES

message

The error message, if JSON is passed this will be coerced to a string.

code

The error code, generally the HTTP status code.

response

The error response, generally the HTTP response.

The following attributes are populated from the error response of the Pro (v2) API, see https://developer.gocardless.com/api-reference/#api-usage-errors

type

The type of error, one of gocardless, invalid_api_usage, invalid_state, or validation_failed.

request_id

The ID of the request, include this if you need to contact GoCardless support.

documentation_url

A link to the GoCardless documentation for the error.

errors

An arrayref of the individual errors, for validation_failed errors these have field and message keys, for other errors they have reason and message keys (and possibly links).

METHODS

description

An alias to the message attribute.

reasons

Returns a list of the reason values from the "errors":

my @reasons = $Exception->reasons;

has_reason

Returns true if any of the "errors" have the given reason:

if ( $Exception->has_reason( 'mandate_is_inactive' ) ) {
    ...
}

conflicting_resource_id

Returns the ID of the resource already created with the idempotency key used in the request, if the error is an idempotent_creation_conflict.

AUTHOR

Lee Johnson - lee@payprop.com

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, features, bug fixes, or anything else then please raise an issue / pull request:

https://github.com/payprop/business-gocardless