Max Lewis-Clarke
02/12/2025, 2:30 PMMarvin
02/12/2025, 2:30 PMSystemExit exception to cause the flow to crash:
python
from prefect import flow
@flow
def boom_crash():
raise SystemExit("Boom crash")
if __name__ == "__main__":
boom_crash()
This flow, boom_crash, will enter a crashed state when run due to the SystemExit exception. You can use this to test your response to crashed flows.
For more information, you can refer to the crashes.py example.
If you need to handle exceptions to convert them to a 'Crashed' state, you might find the exception_to_crashed_state function in the Prefect codebase useful. Unfortunately, the exact usage isn't detailed in the documentation, but you can explore the source code for more insights.