You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Trigger error handlers now allow you to configure specific error handling for individual triggers. Override workspace error handlers with custom, Slack, Teams, or email notifications per trigger.
description: Email error handlers are now available for workspace and trigger error handling. Send automated error notifications via email when jobs fail, supporting multiple recipients and integration with existing error handling workflows.
7
+
features:
8
+
[
9
+
'Email error handlers for workspace-level error notifications',
10
+
'Support for multiple email recipients with validation',
11
+
'Available for both workspace and trigger-specific error handling',
12
+
'Integration with existing Slack, Teams, and custom error handlers',
13
+
'Self-hosted instances only (requires SMTP configuration)'
From a script or flow [deployed](../../core_concepts/0_draft_and_deploy/index.mdx) page, you will find on the "Details & Triggers" - "Email" tab the email address to use.
Email triggers support local error handlers that override workspace error handlers for specific triggers. See the [error handling documentation](../../core_concepts/10_error_handling/index.mdx#trigger-error-handlers) for configuration details and examples.
@@ -2,7 +2,7 @@ import DocCard from '@site/src/components/DocCard';
2
2
3
3
# Error handling
4
4
5
-
There are 5 ways to do error handling in Windmill.
5
+
There are multiple ways to handle errors in Windmill.
6
6
7
7
## try/catch inside a script
8
8
@@ -94,11 +94,18 @@ You can pick the Slack pre-set schedule error handler or define your own.
94
94
95
95
## Workspace error handler
96
96
97
-
Define a script or flow to be executed automatically in case of error in the workspace (e.g. a scheduled job fails to re-schedule).
97
+
Configure automatic error handling for workspace-level errors (e.g. scheduled job failures, trigger failures without their own error handlers). Choose from built-in notification options or define custom error handling logic.
98
98
99
-
### Workspace error handler on Slack and Microsoft Teams
99
+
Configure workspace error handlers from **Workspace Settings > Error Handler** tab. The system supports four types of error handlers:
100
100
101
-
On [Cloud plans and Self-Hosted & Enterprise Edition](/pricing), you can [connect workspace to Slack](../../integrations/slack.mdx) or [Microsoft Teams](../../integrations/teams.mdx) and enable an automated error handler on a given channel.
101
+
### Slack error handler
102
+
103
+
Send error notifications to Slack channels. Requires workspace to be [connected to Slack](../../integrations/slack.mdx).
104
+
105
+
**Configuration:**
106
+
- Enable/disable Slack error handler toggle
107
+
- Specify Slack channel (without # prefix)
108
+
- Available on [Cloud plans and Self-Hosted & Enterprise Edition](/pricing)
102
109
103
110
<iframe
104
111
style={{ aspectRatio: '16/9' }}
@@ -110,49 +117,162 @@ On [Cloud plans and Self-Hosted & Enterprise Edition](/pricing), you can [connec
Send error notifications via email to specified recipients.
122
132
123
-
The following args will be passed to the error handler:
133
+
**Configuration:**
134
+
- Specify email addresses to receive error notifications
135
+
- Only available on Self-Hosted instances (not available on Cloud)
136
+
- Requires SMTP configuration
124
137
125
-
- path: The path of the script or flow that errored.
126
-
- email: The email of the user who ran the script or flow that errored.
127
-
- error: The error details.
128
-
- job_id: The job id.
129
-
- is_flow: Whether the error comes from a flow.
130
-
- workspace_id: The workspace id of the failed script or flow.
138
+
### Custom error handler
131
139
132
-
The Error handler will be executed by the automatically created group g/error_handler. If your error handler requires variables or resources, you need to add them to the group.
140
+
Execute custom scripts or flows as error handlers for advanced error handling logic.
133
141
134
-
Here is a template for your workspace error handler:
142
+
**Configuration:**
143
+
- Script or flow selection via script picker
144
+
- Additional arguments can be configured if the chosen script or flow has parameters
145
+
- Template creation options
146
+
147
+
**Parameters passed to custom error handlers:**
148
+
149
+
All custom workspace error handlers receive the following base parameters:
150
+
151
+
-`workspace_id`: The workspace id where the error occurred
152
+
-`job_id`: The job id of the failed execution
153
+
-`path`: The path of the script or flow that errored
154
+
-`is_flow`: Whether the error comes from a flow
155
+
-`started_at`: When the failed job started
156
+
-`email`: The email of the user who ran the script or flow that errored
157
+
-`schedule_path`: The schedule path (only present if the error comes from a scheduled job)
158
+
159
+
**Custom error handler template:**
135
160
136
161
```ts
137
-
//Workspace error handler template
162
+
//Custom workspace error handler template
138
163
139
164
exportasyncfunction main(
165
+
workspace_id:string, // The workspace id where the error occurred
166
+
job_id:string, // The job id of the failed execution
140
167
path:string, // The path of the script or flow that errored
168
+
is_flow:boolean, // Whether the error comes from a flow
169
+
started_at:string, // When the failed job started
141
170
email:string, // The email of the user who ran the script or flow that errored
142
-
error:object, // The error details
143
-
job_id:string, // The job id
171
+
schedule_path?:string// The schedule path (only present if error from scheduled job)
172
+
) {
173
+
const run_type =is_flow?'flow':'script';
174
+
console.log(
175
+
`Workspace error: ${run_type} ${path} run by ${email} failed in workspace ${workspace_id}`
176
+
);
177
+
console.log(`Job ${job_id} started at ${started_at}`);
- The system prevents infinite loops by not triggering error handlers for error handler jobs themselves
207
+
208
+
### Advanced configuration
209
+
210
+
**Skip error handler for cancelled jobs:**
211
+
Enable the "Do not run error handler for canceled jobs" option to prevent error handlers from triggering when jobs are manually cancelled.
212
+
213
+
214
+
## Trigger error handlers
215
+
216
+
Each trigger type (HTTP routes, Webhooks, Kafka, SQS, WebSocket, Postgres, NATS, MQTT, GCP, Email) can have its own local error handler configured. If a trigger-specific error handler is defined, it will be used for that trigger instead of the workspace error handler. **Trigger error handlers only work for scripts** (not flows).
217
+
218
+
219
+
### Configuring trigger error handlers
220
+
221
+
When creating or editing a trigger, you can configure the same error handler options as workspace error handlers:
222
+
-**Custom script or flow**: Execute your own custom error handling logic
223
+
-**Slack integration**: Send error notifications to Slack channels
224
+
-**Microsoft Teams integration**: Send error notifications to Teams channels
225
+
-**Email notifications**: Send error alerts via email to specified recipients
226
+
227
+
For each trigger error handler, you can also specify:
228
+
-**Error handler arguments**: Additional arguments for the custom error handler (only configurable if the chosen script or flow has parameters)
229
+
-**Retry configuration**: Number of retries and retry strategy before invoking the error handler
230
+
231
+
### Parameters passed to trigger error handlers
232
+
233
+
Trigger error handlers receive the following base parameters:
234
+
-`error`: The error details from the failed job
235
+
-`path`: The path of the script or flow that errored
236
+
-`is_flow`: Whether the error comes from a flow (always `false` for triggers)
237
+
-`trigger_path`: The trigger path in format `<trigger_kind>/<trigger_path>` (e.g., `http_trigger/my-webhook`, `kafka_trigger/my-topic`)
238
+
-`workspace_id`: The workspace id where the error occurred
239
+
-`email`: The email of the user who triggered the execution
240
+
-`job_id`: The job id of the failed execution
241
+
-`started_at`: When the failed job started
242
+
243
+
If using a custom trigger error handler, additional custom arguments can be passed via the error handler configuration.
244
+
245
+
### Example trigger error handler
246
+
247
+
Here's a template for a trigger error handler:
248
+
249
+
```ts
250
+
// Trigger error handler template
251
+
exportasyncfunction main(
252
+
error:object, // The error details from the failed job
253
+
path:string, // The path of the script or flow that errored
144
254
is_flow:boolean, // Whether the error comes from a flow
145
-
workspace_id:string// The workspace id of the failed script or flow
255
+
trigger_path:string, // The trigger path in format <trigger_kind>/<trigger_path>
256
+
workspace_id:string, // The workspace id where the error occurred
257
+
email:string, // The email of the user who triggered the execution
258
+
job_id:string, // The job id of the failed execution
259
+
started_at:string// When the failed job started
146
260
) {
147
261
const run_type =is_flow?'flow':'script';
148
262
console.log(
149
-
`An error occurred with ${run_type} ${path} run by ${email} in workspace ${workspace_id}`
263
+
`Trigger error: ${run_type} ${path} run by ${email} failed in workspace ${workspace_id}`
> ℹ️ When using **Custom Script**, the `raw_body` option is automatically enabled.
400
+
> ℹ️ When using **Custom Script**, the `raw_body` option is automatically enabled.
401
+
402
+
## Error handling
403
+
404
+
HTTP routes support local error handlers that override workspace error handlers for specific routes. See the [error handling documentation](../10_error_handling/index.mdx#trigger-error-handlers) for configuration details and examples.
Copy file name to clipboardExpand all lines: docs/core_concepts/40_websocket_triggers/index.mdx
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -86,6 +86,10 @@ Windmill supports the following filter:
86
86
87
87

88
88
89
+
## Error handling
90
+
91
+
WebSocket triggers support local error handlers that override workspace error handlers for specific triggers. See the [error handling documentation](../10_error_handling/index.mdx#trigger-error-handlers) for configuration details and examples.
// do something with the message content and topic
57
57
}
58
58
```
59
+
60
+
## Error handling
61
+
62
+
Kafka triggers support local error handlers that override workspace error handlers for specific triggers. See the [error handling documentation](../10_error_handling/index.mdx#trigger-error-handlers) for configuration details and examples.
Copy file name to clipboardExpand all lines: docs/core_concepts/45_nats_triggers/index.mdx
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,3 +76,7 @@ A [durable push-consumer](https://docs.nats.io/nats-concepts/jetstream/consumers
76
76
If one already exists, it will be overwritten.
77
77
The consumer name is also used as the `DeliverSubject`, so make sure it's unique.
78
78
79
+
## Error handling
80
+
81
+
NATS triggers support local error handlers that override workspace error handlers for specific triggers. See the [error handling documentation](../10_error_handling/index.mdx#trigger-error-handlers) for configuration details and examples.
0 commit comments