Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
civicrm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
plugins
civicrm
Commits
0c5336dd
Verified
Commit
0c5336dd
authored
5 years ago
by
Andrei Mondoc
Committed by
Kevin Cristiano
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
accept instance of WP_Error
Signed-off-by:
Kevin Cristiano
<
kcristiano@kcristiano.com
>
parent
8411cfb1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wp-rest/Controller/Base.php
+5
-1
5 additions, 1 deletion
wp-rest/Controller/Base.php
with
5 additions
and
1 deletion
wp-rest/Controller/Base.php
+
5
−
1
View file @
0c5336dd
...
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment