src/Http/Client/GuzzleClient.php
private function parseErrorResponse(PsrRequest $request, BadResponseException $ex)
    {
        try {
            $response = $ex->getResponse();
            $document = $response ? $this->factory->createDocumentObject($request, $response) : null;
            $errors = $document ? $document->getErrors() : [];
            $statusCode = $response ? $response->getStatusCode() : 0;
        } catch (Exception $e) {
            $errors = [];
            $statusCode = 0;
        }

        return new JsonApiException($errors, $statusCode, $ex);
    }
private function parseErrorResponse(PsrRequest $request, BadResponseException $ex)
    {
        try {
            $response = $ex->getResponse();
            $document = $response ? $this->factory->createDocumentObject($request, $response) : null;
            $errors = $document ? $document->getErrors() : [];
            $statusCode = $response ? $response->getStatusCode() : 0;
        } catch (Exception $e) {
            $errors = [];
            $statusCode = 0;
        }

        return new JsonApiException($errors, $statusCode, $ex);
    }
private function parseErrorResponse ( PsrRequest $ request , BadResponseException $ ex ) { try { $ response = $ ex -> getResponse ( ) ; $ document = $ response ? $ this -> factory -> createDocumentObject ( $ request , $ response ) : null ; $ errors = $ document ? $ document -> getErrors ( ) : [ ] ; $ statusCode = $ response ? $ response -> getStatusCode ( ) : 0 ; } catch ( Exception $ e ) { $ errors = [ ] ; $ statusCode = 0 ; } return new JsonApiException ( $ errors , $ statusCode , $ ex ) ; }
Safely parse an error response.

This method wraps decoding the body content of the provided exception, so that
another exception is not thrown while trying to parse an existing exception.

@param PsrRequest $request
@param BadResponseException $ex
@return JsonApiException
Safely parse an error response .