api: Use JsonResponse in the ErrorController

refs #9606
This commit is contained in:
Eric Lippmann 2015-09-07 13:37:00 +02:00
parent f467d085b0
commit 26d1a04e48
1 changed files with 4 additions and 5 deletions

View File

@ -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;