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);
    }
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);
    }
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 ) ; }
Parses a ``ClientException`` for any specific exceptions thrown by the
API in the response body. If the response body is not in JSON format,
an ``Exception`` is returned.

Check a ``ClientException`` to see if it has an associated
``ResponseInterface`` object.

@param ClientException $exception
@return Exception
Parses a ClientException for any specific exceptions thrown by the API in the response body . If the response body is not in JSON format an Exception is returned .