跳转到内容
Agentic Workflowdocs
v0.8.2免费安装

节点 / builtin / flow

Try / Catch

Guard the work after it, and route a failure instead of ending the run

流程 扩展程序网页应用

此内容尚不支持你的语言。

Guard the steps after it, so a failure goes down a separate branch instead of ending the run.

Try / Catch has two outputs, Try and Catch. Items go out of Try unchanged, and the steps you connect there are guarded.

If any guarded step fails, the rest of the guarded steps are skipped and the Catch branch runs instead. It receives one item describing the failure:

  • nodeLabel: the name of the node that failed.
  • message: its error message.
  • input: the data that node was given.

The guarded part is everything the Try branch reaches, up to the node where the Try and Catch branches join again. Whatever comes after that join runs in both cases. If the branches never join, everything after Try is guarded to the end of the workflow.

Good to know:

  • A node set to retry uses up all its attempts first; Catch only sees what retrying could not fix. See Error handling.
  • A failure inside the Catch branch is not caught by the same Try / Catch. It goes to an outer Try / Catch, if any, or ends the run.
  • Wrap a step that can fail now and then, such as an API call or reading a page that may change, so the rest of the run still happens.
  • Send yourself a message when a step fails, with the error and the data that caused it.
  • Fall back to another way of getting the data when the first one fails.

To react when a whole workflow fails, from another workflow, use Error Trigger.

设置项类型作用
Note TextWhat this boundary is protecting, for whoever reads the canvas next.

Note is shown on the node to explain what it guards, for example Fetching the order from the API. It does not change how the node behaves.

  • Try
  • Catch

Try carries the incoming items. Catch carries the failure item described above: read it in the catch branch with {{ $input.nodeLabel }} and {{ $input.message }}.

None. This node needs no connection and has no slots for other nodes.

Get warned when an API call fails, without losing the run:

  1. Schedule runs the workflow every morning.
  2. Try / Catch with Note Fetch today's orders.
  3. From Try: Http Request calls https://api.example.com/orders, then Google Sheets appends the orders.
  4. From Catch: Slack posts {{ $input.nodeLabel }} failed: {{ $input.message }}.
  • The run still stops when a step fails. The failing step is not inside the guarded part: it is before the Try / Catch, after the point where Try and Catch join, or in the Catch branch itself. Move the Try / Catch earlier, or connect the step from Try.
  • Steps after the failure were skipped. That is expected: once a guarded step fails, the remaining guarded steps don’t run. Put steps that must always run after the node where both branches join.
  • The Catch branch never runs. Nothing failed, or the node retried until it succeeded. Check the run log.
  • Stop and Error: fail on purpose, for Catch to handle.
  • Error Trigger: run another workflow when a whole run fails.
  • IF: branch on a value before it causes a failure.
编辑此页

最近更新:

Was this page useful?
向 Aria 询问“Try / Catch”