-
Notifications
You must be signed in to change notification settings - Fork 56
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
Errors in Activity Functions cannot be handled using try...except #496
Comments
I'm not a Python expert, but could it be that the I ask because looking at the documentation here, it shows an I'm specifically wondering if this might work: # Orchestrator
@myApp.orchestration_trigger(context_name="context")
def hello_orchestrator(context):
result1 = yield context.call_activity("hello", "Seattle")
try:
result2 = yield context.call_activity("hello", "Tokyo")
except: # handle all error types
result2 = "An error was thrown!"
result3 = yield context.call_activity("hello", "London")
return [result1, result2, result3] |
Yes, I can confirm that Here are the logs:
Some notesThe orchestration completes with the runtime status of {
"name": "hello_orchestrator",
"instanceId": "d371bfcf602a4b0fbe694770472d5d8e",
"runtimeStatus": "Completed",
"input": null,
"customStatus": null,
"output": [
"Hello Seattle",
"An error was thrown!",
"Hello London"
],
"createdTime": "2024-05-02T08:27:51Z",
"lastUpdatedTime": "2024-05-02T08:27:52Z"
} However, the Activity still fails. The log shows In Python, it is idiomatic to return errors as exceptions and let them be handled by the calling function. This means that the Activity should not fail when an exception is raised, but rather when it is not handled by the calling Orchestrator, or a higher function. The status does reflect that correctly with the runtime status of Then of course, there's the issue that the ValueError is raised as an Exception for some reason. |
π Describe the bug
I cannot catch an error thrown inside an activity function in the orchestrator.
π€ Expected behavior
The error should have been caught and handled by the
except
in the orchestrator function.β Steps to reproduce
Logs
The text was updated successfully, but these errors were encountered: