- Post-run error handling: Catch errors after a task has finished executing.
- Real-time error handling: Listens for errors as they happen.
Handle errors after a run
You can catch errors once a task finishes by wrapping execution in atry/catch
block.
Wrap with try/catch
Wrap your task in atry/catch
block to catch any errors thrown when the task completes.
Handle specific errors
You can branch on the error message to handle different cases:Handle errors in real-time
Errors may sometimes occur while a task is running. The AgP JS SDK enables you to listen for them using theonError
event.
Attach a real-time error listener
UseonError
to be notified of errors during task execution.