Fail
yaml
type: "io.kestra.plugin.core.execution.Fail"
Fail the execution.
Used to fail the execution, for example, on a switch branch or on some conditions based on the execution context.
Examples
Fail on a switch branch
yaml
id: fail-on-switch
namespace: company.team
inputs:
- id: param
type: STRING
required: true
tasks:
- id: switch
type: io.kestra.plugin.core.flow.Switch
value: "{{inputs.param}}"
cases:
case1:
- id: case1
type: io.kestra.plugin.core.log.Log
message: Case 1
case2:
- id: case2
type: io.kestra.plugin.core.log.Log
message: Case 2
notexist:
- id: fail
type: io.kestra.plugin.core.execution.Fail
default:
- id: default
type: io.kestra.plugin.core.log.Log
message: default
Fail on a condition
yaml
id: fail-on-condition
namespace: company.team
inputs:
- name: param
type: STRING
required: true
tasks:
- id: before
type: io.kestra.plugin.core.debug.Echo
format: I'm before the fail on condition
- id: fail
type: io.kestra.plugin.core.execution.Fail
condition: '{{ inputs.param == "fail" }}'
- id: after
type: io.kestra.plugin.core.debug.Echo
format: I'm after the fail on condition
Properties
condition
- Type: string
- Dynamic: ✔️
- Required: ❌
Optional condition, must coerce to a boolean.
Boolean coercion allows 0, -0, and '' to coerce to false, all other values to coerce to true.
errorMessage
- Type: string
- Dynamic: ✔️
- Required: ❌
- Default:
Task failure
Optional error message.
Outputs
Definitions
Was this page helpful?