parent
afcd928dfa
commit
1739b950a8
|
@ -6,6 +6,7 @@ use Exception;
|
||||||
use Icinga\Exception\IcingaException;
|
use Icinga\Exception\IcingaException;
|
||||||
use Icinga\Exception\InvalidPropertyException;
|
use Icinga\Exception\InvalidPropertyException;
|
||||||
use Icinga\Exception\NotFoundError;
|
use Icinga\Exception\NotFoundError;
|
||||||
|
use Icinga\Module\Director\Exception\DuplicateKeyException;
|
||||||
use Icinga\Module\Director\Exception\NestingError;
|
use Icinga\Module\Director\Exception\NestingError;
|
||||||
use Icinga\Module\Director\Objects\IcingaObject;
|
use Icinga\Module\Director\Objects\IcingaObject;
|
||||||
use Icinga\Module\Director\Web\Controller\Extension\ObjectRestrictions;
|
use Icinga\Module\Director\Web\Controller\Extension\ObjectRestrictions;
|
||||||
|
@ -37,6 +38,9 @@ abstract class ObjectController extends ActionController
|
||||||
} catch (NotFoundError $e) {
|
} catch (NotFoundError $e) {
|
||||||
$response->setHttpResponseCode(404);
|
$response->setHttpResponseCode(404);
|
||||||
$this->sendJson($response, (object) array('error' => $e->getMessage()));
|
$this->sendJson($response, (object) array('error' => $e->getMessage()));
|
||||||
|
} catch (DuplicateKeyException $e) {
|
||||||
|
$response->setHttpResponseCode(422);
|
||||||
|
$this->sendJson($response, (object) array('error' => $e->getMessage()));
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
if ($response->getHttpResponseCode() === 200) {
|
if ($response->getHttpResponseCode() === 200) {
|
||||||
$response->setHttpResponseCode(500);
|
$response->setHttpResponseCode(500);
|
||||||
|
|
Loading…
Reference in New Issue