def METHOD_NAME(error, model):
    try:
        model = model._from_generated(error.model.error)  # pylint: disable=protected-access
    except AttributeError:  # model can be none
        pass
    raise HttpResponseError(message=error.message, response=error.response, model=model)