Skip to content
Discussion options

You must be logged in to vote

I think you can write it like this:

    try:
        complicated_python_and_rust_library(strIn)
    except (GeneratorExit, KeyboardInterrupt, SystemExit):
        raise
    except BaseException as e:
        with push_scope() as scope:
            scope.add_attachment(
                bytes=strIn.encode(),
            )
            capture_exception(e)
            raise e

I didn't include handling for BaseExceptionGroup because I haven't needed to work with exception groups at all yet, so don't really know what to suggest there. But https://docs.python.org/3/tutorial/errors.html#raising-and-handling-multiple-unrelated-exceptions is probably a good resource.

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
2 replies
@markkimsal
Comment options

@LilyFirefly
Comment options

Comment options

You must be logged in to vote
3 replies
@LilyFirefly
Comment options

Answer selected by markkimsal
@markkimsal
Comment options

@LilyFirefly
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants