First of all, thx for your work!
When calling your Library with wrong token like
$netbox = new Client("https://demo.netbox.dev/", "wrong token");
I got
Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error: GET https://demo.netbox.dev/api/dcim/sites resulted in a 403 Forbidden response: {"detail":"Invalid token"} in /var/www/sharelib/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:111 Stack trace: #0 /var/www/sharelib/vendor/guzzlehttp/guzzle/src/Middleware.php(72): GuzzleHttp\Exception\RequestException::create() #1 /var/www/sharelib/vendor/guzzlehttp/promises/src/Promise.php(209): GuzzleHttp\Middleware::GuzzleHttp{closure}() #2 /var/www/sharelib/vendor/guzzlehttp/promises/src/Promise.php(158): GuzzleHttp\Promise\Promise::callHandler() #3 /var/www/sharelib/vendor/guzzlehttp/promises/src/TaskQueue.php(52): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise{closure}() #4 /var/www/sharelib/vendor/guzzlehttp/promises/src/Promise.php(251): GuzzleHttp\Promise\TaskQueue->run() #5 /var/www/sharelib/vendor/guzzlehttp/promises/src/Promise.php(227): GuzzleHttp\Promise\Promise->invokeWaitFn() #6 /var/www/sharelib/vendor/guzzlehttp/promises/src/Promise.php(272): GuzzleHttp\Promise\Promise->waitIfPending() #7 /var/www/sharelib/vendor/guzzlehttp/promises/src/Promise.php(229): GuzzleHttp\Promise\Promise->invokeWaitList() #8 /var/www/sharelib/vendor/guzzlehttp/promises/src/Promise.php(69): GuzzleHttp\Promise\Promise->waitIfPending() #9 /var/www/sharelib/vendor/guzzlehttp/guzzle/src/Client.php(189): GuzzleHttp\Promise\Promise->wait() #10 /var/www/sharelib/vendor/ndamiens/netbox-client-php/src/Client.php(82): GuzzleHttp\Client->request() #11 /var/www/nmt2010/tools/test_rest_netbox.php(69): ND\Netbox\Client->getSites() #12 {main} thrown in /var/www/sharelib/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 111
From my point of view it's impossible to catch this in my application, but should be somewhere in Client.php as it fails fatally before it gets back to my above call. Should be from my POV handled in public function getGuzzleClient() of Client.php, there are several hints around in the net to it with a $this->g_client->wait() but how and where I am not able to resolve...
First of all, thx for your work!
When calling your Library with wrong token like
$netbox = new Client("https://demo.netbox.dev/", "wrong token");
I got
Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error:
GET https://demo.netbox.dev/api/dcim/sitesresulted in a403 Forbiddenresponse: {"detail":"Invalid token"} in /var/www/sharelib/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:111 Stack trace: #0 /var/www/sharelib/vendor/guzzlehttp/guzzle/src/Middleware.php(72): GuzzleHttp\Exception\RequestException::create() #1 /var/www/sharelib/vendor/guzzlehttp/promises/src/Promise.php(209): GuzzleHttp\Middleware::GuzzleHttp{closure}() #2 /var/www/sharelib/vendor/guzzlehttp/promises/src/Promise.php(158): GuzzleHttp\Promise\Promise::callHandler() #3 /var/www/sharelib/vendor/guzzlehttp/promises/src/TaskQueue.php(52): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise{closure}() #4 /var/www/sharelib/vendor/guzzlehttp/promises/src/Promise.php(251): GuzzleHttp\Promise\TaskQueue->run() #5 /var/www/sharelib/vendor/guzzlehttp/promises/src/Promise.php(227): GuzzleHttp\Promise\Promise->invokeWaitFn() #6 /var/www/sharelib/vendor/guzzlehttp/promises/src/Promise.php(272): GuzzleHttp\Promise\Promise->waitIfPending() #7 /var/www/sharelib/vendor/guzzlehttp/promises/src/Promise.php(229): GuzzleHttp\Promise\Promise->invokeWaitList() #8 /var/www/sharelib/vendor/guzzlehttp/promises/src/Promise.php(69): GuzzleHttp\Promise\Promise->waitIfPending() #9 /var/www/sharelib/vendor/guzzlehttp/guzzle/src/Client.php(189): GuzzleHttp\Promise\Promise->wait() #10 /var/www/sharelib/vendor/ndamiens/netbox-client-php/src/Client.php(82): GuzzleHttp\Client->request() #11 /var/www/nmt2010/tools/test_rest_netbox.php(69): ND\Netbox\Client->getSites() #12 {main} thrown in /var/www/sharelib/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 111From my point of view it's impossible to catch this in my application, but should be somewhere in Client.php as it fails fatally before it gets back to my above call. Should be from my POV handled in public function getGuzzleClient() of Client.php, there are several hints around in the net to it with a $this->g_client->wait() but how and where I am not able to resolve...