Skip to content

After this module your workflows fail loudly and gracefully: reusable sub-workflows, handled errors, and an alert whenever something crashes.

What it does

Three workflows that work together:

  • 04 - Safe Divide API (learner.json): POST /webhook/divide {a, b}. It validates input (400), calls a sub-workflow, and turns sub-workflow errors into a clean 422. POST /webhook/crash simulates an unhandled failure.
  • 04 - Divide (sub-workflow) (learner-sub.json): reusable logic that throws "Cannot divide by zero".
  • 04 - Error Logger (learner-error.json): runs whenever the API workflow crashes and builds an alert message with a link to the failed execution.

Flow

Divide API → Numbers? ─true─→ Divide (sub-workflow) ─success─→ Respond OK (200)
                      │                             └error───→ Respond Calculation Error (422)
                      └false→ Respond Bad Input (400)

Crash API → Simulate Crash  ⇒  (workflow fails)  ⇒  04 - Error Logger: Error Trigger → Format Alert → Send Alert

Files

File Tier Purpose
lesson.md Free Step-by-step build
workflow/starter.json Free Webhook + validation only
workflow/learner.json Learner Main API workflow
workflow/learner-sub.json Learner Sub-workflow
workflow/learner-error.json Learner Error workflow
exercises.md Learner Practice tasks
solutions.md Learner Exercise solutions
notes.md Private Learning log
sell/ Private Offer, video script, blog post

Importing via the UI: import the sub-workflow and error logger first and publish them. Then import the main workflow and re-select the sub-workflow in Divide (sub-workflow) and the error workflow in Settings → Error Workflow (IDs change on import). ./scripts/load-workflow.sh modules/04-bulletproof-workflows does all of this automatically.