Skip to content
Snippets Groups Projects
Verified Commit 0c5336dd authored by Andrei Mondoc's avatar Andrei Mondoc Committed by Kevin Cristiano
Browse files

accept instance of WP_Error

parent 8411cfb1
No related branches found
No related tags found
No related merge requests found
......@@ -88,7 +88,7 @@ abstract class Base extends \WP_REST_Controller implements Endpoint_Interface {
* Wrapper for WP_Error.
*
* @since 0.1
* @param string|\CiviCRM_API3_Exception $error
* @param string|\CiviCRM_API3_Exception|\WP_Error $error
* @param mixed $data Error data
* @return WP_Error $error
*/
......@@ -98,6 +98,10 @@ abstract class Base extends \WP_REST_Controller implements Endpoint_Interface {
return $error->getExtraParams();
} elseif ( $error instanceof \WP_Error ) {
return $error;
}
return new \WP_Error( 'civicrm_rest_api_error', $error, empty( $data ) ? [ 'status' => $this->authorization_status_code() ] : $data );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment