Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dsl-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,7 @@ Defines the configuration of a catch clause, which a concept used to catch error
| exceptWhen | `string` | `no` | A runtime expression used to determine whether or not to catch the filtered error. |
| retry | `string`<br>[`retryPolicy`](#retry) | `no` | The [`retry policy`](#retry) to use, if any, when catching [`errors`](#error).<br>*If a `string`, must be the name of a [retry policy](#retry) defined in the [workflow's reusable components](#use).* |
| do | [`map[string, task]`](#task) | `no` | The definition of the task(s) to run when catching an error. |
| then | [`flowDirective`](#flow-directive) | `no` | The [flow directive](#flow-directive) to execute for the error path after the error has been caught (and after executing any `do` tasks, if set). This determines the next transition for the catch path (overriding the try task’s normal completion flow). |

#### Wait

Expand Down
26 changes: 26 additions & 0 deletions examples/try-catch-then-directive.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
document:
dsl: '1.0.3'
namespace: test
name: try-catch-then-directive
version: '0.1.0'
do:
- trySomething:
try:
- callExternalService:
call: http
with:
method: get
endpoint: https://external-service.example.com/api
catch:
errors:
with:
type: https://serverlessworkflow.io/dsl/errors/types/communication
status: 503
then: recordFailure
- continueProcessing:
set:
status: ok
then: end
- recordFailure:
set:
status: failed
4 changes: 4 additions & 0 deletions schema/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,10 @@ $defs:
$ref: '#/$defs/taskList'
title: TryTaskCatchDo
description: The definition of the task(s) to run when catching an error.
then:
$ref: '#/$defs/flowDirective'
title: TryTaskCatchThen
description: The flow directive to execute for the error path after the error has been caught (and after executing any `do` tasks, if set). When set, this determines the next transition instead of the try task's top-level `then` or the default sequential flow.
waitTask:
type: object
title: WaitTask
Expand Down
Loading