Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add utility function to classify exceptions as failing the workflow vs failing the task #589

Open
dandavison opened this issue Jan 28, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@dandavison
Copy link
Contributor

See the waiting_for_handlers and waiting_for_handlers_and_compensation Python samples added in temporalio/samples-python#144, which feature a utility function like this:

def is_workflow_exit_exception(e: BaseException) -> bool:
    """
    True if the exception is of a type that will cause the workflow to exit.

    This is as opposed to exceptions that cause a workflow task failure, which
    are retried automatically by Temporal.
    """
    # 👉 If you have set additional failure_exception_types you should also
    # check for these here.
    return isinstance(e, (asyncio.CancelledError, exceptions.FailureError))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant