Larabros\Elogram\Http\Clients\AbstractAdapter::resolveExceptionClass PHP Method

resolveExceptionClass() protected method

Check a ClientException to see if it has an associated ResponseInterface object.
protected resolveExceptionClass ( GuzzleHttp\Exception\ClientException $exception ) : Larabros\Elogram\Exceptions\Exception
$exception GuzzleHttp\Exception\ClientException
return Larabros\Elogram\Exceptions\Exception
    protected function resolveExceptionClass(ClientException $exception)
    {
        $response = $exception->getResponse()->getBody();
        $response = json_decode($response->getContents());
        if ($response === null) {
            return new Exception($exception->getMessage());
        }
        $meta = isset($response->meta) ? $response->meta : $response;
        $class = '\\Larabros\\Elogram\\Exceptions\\' . $meta->error_type;
        return new $class($meta->error_message);
    }