https://prefect.io logo
Title
i

Ilya Sapunov

05/30/2022, 5:23 PM
Hello! I’m trying to figure out why my local runs differ from prefect cloud. I expect that my task will handle exception, and it perfectly works local, but in cloud my flow fails with strange error message “‘traceback’ object is not subscriptable”. How can I fix this?
a

Anna Geller

05/30/2022, 5:35 PM
You can remove all try except blocks and this should fix your issue - no need to trap exceptions if you are using Prefect
i

Ilya Sapunov

05/31/2022, 8:46 AM
Thank you for your answer, but I use try except for validation logic in my flow and it has multiple layers. Is there any convenient way to use try except in prefect?
a

Anna Geller

05/31/2022, 9:52 AM
there certainly is, but you shouldn't need to use try except when you use Prefect - try/except traps an exception. in contrast, with Prefect you can actively use an exception to drive further actions e.g. via triggers and state handlers • https://docs.prefect.io/core/concepts/execution.html#triggershttps://docs.prefect.io/core/concepts/notifications.html#state-handlers
🙏 1