https://prefect.io logo
Title
m

Mark NS

02/27/2023, 11:10 AM
Hi, I'd like to get access to the
State
object for a failed task, but I'm not sure how to do that when the task throws an exception. Any advice?
try:
    state: State = trigger_sync.with_options(
        name=connection.name
    )(
        airbyte_server=airbyte_server,
        connection_id=connection.connection_id
    )
except AirbyteSyncJobFailed as e:
   // state is undefined
c

Christopher Boyd

02/27/2023, 8:06 PM
what’s the task call here? running a task by default returns just the data, to return state, it should be
task(return_state=True)