src/Exception/RequestException.php
public static function create(
        Request $request,
        Response $response = null,
        Exception $previous = null
    ) {
        if (!$response) {
            return new self('Error completing request', $request, null, $previous);
        }

        $code = $response->getStatusCode();

        switch ($code[0]) {
            case '4':
                $message = 'Client Error';
                break;
            case '5':
                $message = 'Server Error';
                break;
            default:
                $message = 'Unknown Error';
                break;
        }

        return new self($message, $request, $response, $previous);
    }
public static function create(
        Request $request,
        Response $response = null,
        Exception $previous = null
    ) {
        if (!$response) {
            return new self('Error completing request', $request, null, $previous);
        }

        $code = $response->getStatusCode();

        switch ($code[0]) {
            case '4':
                $message = 'Client Error';
                break;
            case '5':
                $message = 'Server Error';
                break;
            default:
                $message = 'Unknown Error';
                break;
        }

        return new self($message, $request, $response, $previous);
    }
public static function create ( Request $ request , Response $ response = null , Exception $ previous = null ) { if ( ! $ response ) { return new self ( 'Error completing request' , $ request , null , $ previous ) ; } $ code = $ response -> getStatusCode ( ) ; switch ( $ code [ 0 ] ) { case '4' : $ message = 'Client Error' ; break ; case '5' : $ message = 'Server Error' ; break ; default : $ message = 'Unknown Error' ; break ; } return new self ( $ message , $ request , $ response , $ previous ) ; }
Creates a new exception based on input data

@param Request   $request
@param Response  $response
@param Exception $previous
Creates a new exception based on input data