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);
    }