def METHOD_NAME(self) -> Iterator["JsonReporter"]:
    if not self.opts.enabled:
        yield self
        return
    message = None
    exception = None
    try:
        with redirect_stdout(self.stdout):
            yield self
    except WrappedException as exc:
        message = str(exc)
        if not exc.hide_wrapped_exception:
            exception = exc.__cause__
    except BeetException as exc:
        message = str(exc)
    except Exception as exc:
        message = "An unhandled exception occurred. This could be a bug."
        exception = exc
    if message is None:
        self.data["status"] = "success"
    else:
        self.data["status"] = "error"
        error = self.data.setdefault("error", {})
        error["message"] = message
        exc_fullname = get_import_string(type(exception))
        if exception is None:
            traceback = None
        elif self.opts.exception_filter is None:
            traceback = format_exc(exception)
        elif any(f in exc_fullname for f in self.opts.exception_filter.entries()):
            traceback = f"{type(exception).__name__}: {exception}\n"
        else:
            traceback = f'{type(exception).__name__}: Disable the "exception_filter" option to see the full traceback.\n'
        error["exception"] = traceback
    self.ctx.require(*self.handlers)