# Error handling system with Postgres: n8n workflow template

> Started by an event in a connected app, and works across Email and Postgres. 13 steps, 1 branch: a working afternoon to understand properly.

Source: https://millionrounds.com/workflow/error-handling-system-with-postgres (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Alerts and monitoring](https://millionrounds.com/workflows?category=Alerts+and+monitoring#library)

# Error handling system with Postgres

Started by an event in a connected app, and works across Email and Postgres. 13 steps, 1 branch: a working afternoon to understand properly.

Medium

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Ferror-handling-system-with-postgres)

**13 steps** Medium: a working afternoon

**1** Branch: places the flow splits

**0** Loops or waits

**2** Services it connects to

## The flow

Starts it 3 Logic 4 Service 6

The steps in the order they run, from what starts it.

- 1 **Error Trigger** Error trigger *Starts it*
- 2 **Sometimes... just cleanup** Manual trigger *Starts it*
- 3 **Call this Sample - Prepend to your error catcher** Execute Workflow *Logic*
- 4 **See below to prepend this at your error handling** Execute Workflow trigger *Starts it*
- 5 **Insert Log** Postgres *Service*
- 6 **Count for 5 minutes** Postgres *Service*
- 7 **Truncate Log Database** Postgres *Service*
- 8 **Principal E-Mail** Email Send *Service*
- 9 **Push mobile notification** Pushover *Service*
- 10 **CleanUp execution. See below if you will prepend this workflow** Code *Logic*
- 11 **If there is no logs in 5 minutes** If *Logic*
- 12 **Fallback E-Mail** Email Send *Service*
- 13 **Insert your error handling logic after this** No Op *Logic*

## How it's built

- **Starts on:** An event in a connected app
- **Steps:** 13, with 1 branch
- **Size:** Medium: a working afternoon
- **Connects to:** Email, Postgres
- **Model:** None. This is plumbing, not judgement

## Questions

What does it need to run?

An n8n account, plus your own Email and Postgres accounts. You connect your own accounts after importing it; none are included.

What starts it?

It starts on an event in a connected app.

Does it use AI?

No. Every step is fixed logic or a call to a service, so it does the same thing every time.

How long does it take to set up?

Plan an afternoon. 13 steps is enough that you should read each one before running it.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 13 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Ferror-handling-system-with-postgres)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Email](https://millionrounds.com/workflows?service=Email#library)[Postgres](https://millionrounds.com/workflows?service=Postgres#library)

## Workflows like it

Also alerts and monitoring, with the same services where possible, closest in size first.

- [**Detect content decay from Google Search Console and alert** 13 steps · Email, Google Sheets](https://millionrounds.com/workflow/detect-content-decay-from-google-search-console-and-alert)
- [**Generate videos with Veo3 Fast API and Google Drive** 13 steps · Email, Google Drive](https://millionrounds.com/workflow/generate-videos-with-veo3-fast-api-and-google-drive)
- [**Monitor medical equipment with Google Sheets** 13 steps · Email, Google Sheets](https://millionrounds.com/workflow/monitor-medical-equipment-with-google-sheets)
- [**Real-time cryptocurrency price monitor with CoinGecko** 13 steps · Discord, Email](https://millionrounds.com/workflow/real-time-cryptocurrency-price-monitor-with-coingecko)
- [**Real-time flight tracking with Aviation API and Slack** 13 steps · Postgres](https://millionrounds.com/workflow/real-time-flight-tracking-with-aviation-api-and-slack)
- [**Scheduled Google Drive monitoring with Postgres** 13 steps · Google Drive, Postgres](https://millionrounds.com/workflow/scheduled-google-drive-monitoring-with-postgres)
