From 6ae90bba5e22804c06adc558a697f56b583c0531 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