mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-28 00:04:05 +02:00
parent
218e67527b
commit
a1b7cd216b
@ -3,6 +3,7 @@
|
||||
namespace Icinga\Module\Director\Core;
|
||||
|
||||
use Icinga\Application\Benchmark;
|
||||
use Icinga\Exception\ConfigurationError;
|
||||
use Exception;
|
||||
|
||||
class RestApiClient
|
||||
@ -172,6 +173,14 @@ class RestApiClient
|
||||
if ($res === false) {
|
||||
throw new Exception('CURL ERROR: ' . curl_error($curl));
|
||||
}
|
||||
|
||||
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
||||
if ($statusCode === 401) {
|
||||
throw new ConfigurationError(
|
||||
'Unable to authenticate, please check your API credentials'
|
||||
);
|
||||
}
|
||||
|
||||
Benchmark::measure('Rest Api, got response');
|
||||
|
||||
if ($stream) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user