diff --git a/library/Director/Core/RestApiResponse.php b/library/Director/Core/RestApiResponse.php index 3145f1d3..253fed1f 100644 --- a/library/Director/Core/RestApiResponse.php +++ b/library/Director/Core/RestApiResponse.php @@ -87,6 +87,13 @@ class RestApiResponse $this->setJsonError(); throw new IcingaException('Parsing JSON result failed: ' . $this->errorMessage); } + if (property_exists($result, 'error')) { + if (property_exists($result, 'status')) { + throw new IcingaException('API request failed: ' . $result->status); + } else { + throw new IcingaException('API request failed: ' . var_export($result, 1)); + } + } $this->results = $result->results; // TODO: Check if set return $this;