def _handle_failure(self, on_failure, error):
        """Handles the situation where a resource failed to succeed.

        :param callable on_failure: What should be done when the resource
                                    failed?
        :param str error: Error message.

        If `on_failure` is ``None``, nothing is done when the resource failed.
        Otherwise, it is called with `error`. If the returned value is an
        exception, it is raised.
        """
        if on_failure is not None:
            obj = on_failure(error)
            if isinstance(obj, Exception):
                raise obj
dataset/ETHPy150Open s3rvac/retdec-python/retdec/resource.py/Resource._handle_failure/original