What have people come up with as a best practice f...
# ask-community
s
What have people come up with as a best practice for having tasks indicate that they failed? I could not find any example of a task that could fail in the docs or what failure would look like. Returning “none” is not a failure. Are only uncaught exceptions failures?
👀 1
c
Hi Sean - for this you can do one of two things: • use a Prefect Signal (a special exception type): https://docs.prefect.io/core/concepts/execution.html#state-signals • use a Prefect State Handler: https://docs.prefect.io/core/concepts/notifications.html#state-handlers This will allow you to override the state based on whatever conditions are important to you and return a
Failed
state instead of
Success
a
I raise
prefect.engine.signals.FAIL
passing an error message
upvote 3
s
Thank you both.