From 26d1a04e489c3b550d208d4379b86055040bac35 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 7 Sep 2015 13:37:00 +0200 Subject: [PATCH] api: Use JsonResponse in the ErrorController refs #9606 --- application/controllers/ErrorController.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/application/controllers/ErrorController.php b/application/controllers/ErrorController.php index c82f544c0..62198ec0c 100644 --- a/application/controllers/ErrorController.php +++ b/application/controllers/ErrorController.php @@ -3,6 +3,7 @@ namespace Icinga\Controllers; +use Icinga\Web\Response\JsonResponse; use Zend_Controller_Plugin_ErrorHandler; use Icinga\Application\Icinga; use Icinga\Application\Logger; @@ -86,11 +87,9 @@ class ErrorController extends ActionController } if ($this->getRequest()->isApiRequest()) { - // @TODO(el): Use ApiResponse class for unified response handling. - $this->getResponse()->sendJson(array( - 'status' => 'error', - 'message' => $this->view->message - )); + $this->getResponse()->json() + ->setErrorMessage($this->view->message) + ->sendResponse(); } $this->view->request = $error->request;