Raises an exception produced by **error_factory** if a predicate fails.

        :param error_factory:
            Class or callable (e.g. :class:`Exception`) which will be invoked to produce the resulting exception.
            You can define a custom callable here; it will be given the underlying predicate's exception (AssertError)
            as the first argument, followed by any arguments passed to ``or_raise``.
        :param message:
            String to be formatted and passed as the first argument to *error_factory*. If this is given, subsequent
            arguments passed to ``or_raise`` will be used to format contents of the string, and will not be passed to
            ``error_factory``. The keyword argument ``error`` will be set to the underlying predicate's exception.

def or_raise(self, error_factory, message=None, *args, **kwargs):
        """
        Raises an exception produced by **error_factory** if a predicate fails.

        :param error_factory:
            Class or callable (e.g. :class:`Exception`) which will be invoked to produce the resulting exception.
            You can define a custom callable here; it will be given the underlying predicate's exception (AssertError)
            as the first argument, followed by any arguments passed to ``or_raise``.
        :param message:
            String to be formatted and passed as the first argument to *error_factory*. If this is given, subsequent
            arguments passed to ``or_raise`` will be used to format contents of the string, and will not be passed to
            ``error_factory``. The keyword argument ``error`` will be set to the underlying predicate's exception.
        """
        if self._exception:
            if message is None:
                raise error_factory(self._exception, *args, **kwargs)
            else:
                kwargs.setdefault("error", self._exception)
                raise error_factory(message.format(*args, **kwargs))