You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to catch an AssertionError that is raised within my task, but it seems I can only catch generic RuntimeErrors, and I can't figure out how to see what other errors may have been raised before it (programmatically)
For example, this will not work:
importd6tflowclassTaskExample(d6tflow.tasks.TaskCache):
defrun(self):
result=5+5assertresult>100, "result must be greater than 100"self.save(result)
try:
d6tflow.run(TaskExample())
exceptAssertionError:
# do some special logic here for this particular errorprint("Exception caught")
This will work but it's not desirable to catch all generic RuntimeErrors
importd6tflowclassTaskExample(d6tflow.tasks.TaskCache):
defrun(self):
result=5+5assertresult>100, "result must be greater than 100"self.save(result)
try:
d6tflow.run(TaskExample())
exceptRuntimeError:
print("Exception caught")
I tried using the traceback library to get the stack trace but I could only get the stack trace of the RuntimeError, which is not very useful. Is there any way to catch a specific error or at least get the last error that was raised before RuntimeError?
Edit: Also, when you except a RuntimeError, the stack trace still prints and I'm wondering if there's a way to suppress that
The text was updated successfully, but these errors were encountered:
I would like to catch an AssertionError that is raised within my task, but it seems I can only catch generic RuntimeErrors, and I can't figure out how to see what other errors may have been raised before it (programmatically)
For example, this will not work:
This will work but it's not desirable to catch all generic RuntimeErrors
I tried using the
traceback
library to get the stack trace but I could only get the stack trace of the RuntimeError, which is not very useful. Is there any way to catch a specific error or at least get the last error that was raised before RuntimeError?Edit: Also, when you except a
RuntimeError
, the stack trace still prints and I'm wondering if there's a way to suppress thatThe text was updated successfully, but these errors were encountered: