Processes an exception thrown by an API request for a submission.
Description
See also
Parameters
- $exception
-
(Exception) (Required) Exception thrown by the API request.
- $submission
-
(awsmug\Torro_Forms\DB_Objects\Submissions\Submission) (Required) Submission for which the API request was made.
- $form
-
(awsmug\Torro_Forms\DB_Objects\Forms\Form) (Required) Form the submission applies to.
Return
(bool|WP_Error) True on success, error object on failure.
Source
File: src/modules/actions/api-action.php
protected function process_error_response( $exception, $submission, $form ) { // The default implementation simply transforms the exceptions into errors. if ( is_a( $exception, APIAPIException::class ) ) { /* translators: 1: name of the API, 2: error message */ return new WP_Error( 'apirequest_apiapi_exception', sprintf( __( 'An API error occurred while trying to call the %1$s API. Original error message: %2$s', 'torro-forms' ), $this->api()->get_title(), $exception->getMessage() ), $exception->getData() ); } /* translators: 1: name of the API, 2: error message */ return new WP_Error( 'apirequest_exception', sprintf( __( 'An error occurred while trying to call the %1$s API. Original error message: %2$s', 'torro-forms' ), $this->api()->get_title(), $exception->getMessage() ) ); }
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |