-
Notifications
You must be signed in to change notification settings - Fork 145
Description
I'm attempting to wrap the new client request in a try/catch so that I might catch any exceptions when creating the client (should someone remove the app, should the access token accidentally get changed, etc). I thought perhaps I needed to use Http\Client\Common\Exception\ClientErrorException instead of Http\Client\Exception -- but that didn't work either. I'm sure this is something completely silly that I'm overlooking here.
Version info
- intercom-php version: 1.4
- Intercom API version: 4.3
- PHP version: 7.2.4
Expected behavior
Would expect to receive an error object that I could then evaluate.
Actual behavior
PHP Uncaught exception:
Fatal error: Uncaught Http\Client\Common\Exception\ClientErrorException: Unauthorized in /path/to/app/vendor/php-http/client-common/src/Plugin/ErrorPlugin.php:83 Stack trace: #0 /path/to/app/vendor/php-http/client-common/src/Plugin/ErrorPlugin.php(65): Http\Client\Common\Plugin\ErrorPlugin->transformResponseToException(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response)) #1 /path/to/app/endor/php-http/httplug/src/Promise/HttpFulfilledPromise.php(31): Http\Client\Common\Plugin\ErrorPlugin->Http\Client\Common\Plugin{closure}(Object(GuzzleHttp\Psr7\Response)) #2/path/to/app/vendor/php-http/client-common/src/Plugin/ErrorPlugin.php(66): Http\Client\Promise\HttpFulfilledPromise->then(Object(Closure)) #3 /path/to/app/vendor/php-http/client-common/src/PluginChain.php(48): Http\Client\Common\Plugin\ErrorPlugin->handleRequest(Object(GuzzleHttp\Psr7\Request), Object(Closure), Object(Http\Client\Common\PluginChain)) #4 /path/to/app/vendor/php-http/client-common/src/PluginChain.php(63): Http\Client\C in /path/to/app/vendor/php-http/client-common/src/Plugin/ErrorPlugin.php on line 83
Steps to reproduce (as granular as possible, including screenshots where appropriate)
try {
$client = new IntercomClient('invalidaccesstokenheretothrowerror');
} catch (Http\Client\Exception $e) {
var_dump($e);
}