public function createDbalException(Response $response, DriverExceptionInterface $exception) {
        switch ($response->getStatusCode()) {
            case Response::HTTP_BAD_REQUEST:
                return new DBALException\SyntaxErrorException($response->getContent(), $exception);

            case Response::HTTP_METHOD_NOT_ALLOWED:
            case Response::HTTP_NOT_ACCEPTABLE:
            case Response::HTTP_REQUEST_TIMEOUT:
            case Response::HTTP_LENGTH_REQUIRED:
            case Response::HTTP_INTERNAL_SERVER_ERROR:
                return new DBALException\ServerException($response->getContent(), $exception);
            
            case Response::HTTP_CONFLICT:
                return new DBALException\ConstraintViolationException($response->getContent(), $exception);

            case Response::HTTP_UNAUTHORIZED:
            case Response::HTTP_FORBIDDEN:
            case Response::HTTP_PROXY_AUTHENTICATION_REQUIRED:
            case Response::HTTP_BAD_GATEWAY:
            case Response::HTTP_SERVICE_UNAVAILABLE:
            case Response::HTTP_GATEWAY_TIMEOUT:
                return new DBALException\ConnectionException($response->getContent(), $exception);

            default:
                return new DBALException\DriverException($response->getContent(), $exception);
        }
    }