From d808e1ca416af0e6ca6bd37b85baeaf7d74b032d Mon Sep 17 00:00:00 2001 From: Andrei Mondoc <andreimondoc@gmail.com> Date: Thu, 29 Aug 2019 15:29:32 +0100 Subject: [PATCH] assign error, don't return it from catch block Always format the result! If we call the 'rest' endpoint without json param we are getting the error in json format instead of the expected xml format. Signed-off-by: Kevin Cristiano <kcristiano@kcristiano.com> --- wp-rest/Controller/Rest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-rest/Controller/Rest.php b/wp-rest/Controller/Rest.php index 0aeb3dff57..61706f85fd 100644 --- a/wp-rest/Controller/Rest.php +++ b/wp-rest/Controller/Rest.php @@ -78,7 +78,7 @@ class Rest extends Base { } catch ( \CiviCRM_API3_Exception $e ) { - return $this->civi_rest_error( $e->getMessage() ); + $items = $this->civi_rest_error( $e ); } -- GitLab