Guard clause — refuse bad orders
Fail fast, loudly: a zero-amount order trips Stop & Error with a coded message, and the whole run fails exactly where the data went wrong. THIS TEST IS SUPPOSED TO FAIL — that's the demo. Flip amount to 100 to watch it pass.
What’s inside
4 nodes — every type links to its full reference page.
| Step | Node | Type |
|---|---|---|
| Suspicious order | Inject | input.inject |
| Amount > 0? | IF | logic.if |
| Accept | Console | utility.console |
| Refuse | Stop and Error | error-handling.stop-and-error |
Import it
- Studio → Import — paste the JSON below (or the URL
/docs/templates/guard-clause-refuse-bad-orders.json). - Or ask the AI Copilot with the JSON pasted after the phrase:
import this workflow json into a new workflow named "Guard clause — refuse bad orders" - Any credentials the nodes need are
${credential.…}references — add them once in Admin → Credentials and the template picks them up. Nothing secret ships in a template.
The workflow document (flowdrome.workflow.v1, 4 node types)
{
"schemaVersion": "flowdrome.workflow.v1",
"id": "",
"name": "Guard clause — refuse bad orders",
"version": "0",
"status": "draft",
"nodes": [
{
"id": "seed",
"type": "input.inject",
"label": "Suspicious order",
"category": "trigger",
"config": {
"contentType": "application/json",
"payload": {
"orderId": "A-1005",
"amount": 0
}
},
"position": {
"x": 0,
"y": 23
}
},
{
"id": "sane",
"type": "logic.if",
"label": "Amount > 0?",
"category": "flow",
"config": {
"path": "amount",
"operator": "greaterThan",
"value": 0
},
"position": {
"x": 530,
"y": 23
}
},
{
"id": "ok",
"type": "utility.console",
"label": "Accept",
"category": "utility",
"config": {
"message": "order {{ $json.orderId }} accepted"
},
"position": {
"x": 1060,
"y": 0
}
},
{
"id": "stop",
"type": "error-handling.stop-and-error",
"label": "Refuse",
"category": "utility",
"config": {
"message": "order {{ $json.orderId }} has amount 0 — refusing to invoice",
"errorCode": "BAD_ORDER"
},
"position": {
"x": 1060,
"y": 178
}
}
],
"edges": [
{
"id": "e0",
"sourceNodeId": "seed",
"sourcePort": "output",
"targetNodeId": "sane",
"targetPort": "input"
},
{
"id": "e1",
"sourceNodeId": "sane",
"sourcePort": "true",
"targetNodeId": "ok",
"targetPort": "input"
},
{
"id": "e2",
"sourceNodeId": "sane",
"sourcePort": "false",
"targetNodeId": "stop",
"targetPort": "input"
}
],
"triggers": [
{
"id": "t0",
"nodeId": "seed"
}
],
"meta": {
"snippets": [],
"source": "template-gallery",
"description": "Fail fast, loudly: a zero-amount order trips Stop & Error with a coded message, and the whole run fails exactly where the data went wrong. THIS TEST IS SUPPOSED TO FAIL — that's the demo. Flip amount to 100 to watch it pass."
}
} Generated from the verified demo corpus — this exact document seeds and runs on a fresh Flowdrome. Raw JSON: guard-clause-refuse-bad-orders.json.