Error handling
Get actionable visibility into event, task, and action errors
Mechanic creates error events when an error occurs during an event run, a task run, or an action run. Each run type has its own error event topic. You can subscribe to these error topics to take action based on these errors (e.g. to send an email letting you know an error has occurred).
There are three error topics that Mechanic can throw:
mechanic/errors/action
, mechanic/errors/event
, mechanic/errors/task
.Any task may subscribe to error events.
If a task subscribes only to error events, it's qualified to receive all such error events, across all runs in the same Mechanic account.
If a task subscribes to other non-error topics, too, the task will only receive its own
mechanic/errors/task
and mechanic/errors/action
events. It won't be able to receive mechanic/errors/event
events.This occurs when an action run encounters an error. (Examples: a server connection failure during an FTP action, or a missing or invalid receipient email address during an Email action.)
This occurs when a task run fails. (Examples: a task run exceeds Mechanic's memory limits, a Liquid parsing or rendering failure, or encountering an error object.)
1
{
2
"message": "Received a Shopify error (resource invalid): Add at least 1 product",
3
"event": {
4
"id": "ebaa2ab5-fc48-4a5e-8591-11111",
5
"topic": "mechanic/user/trigger",
6
"source": "user",
7
"created_at": "2023-06-13T17:03:27.244Z",
8
"webhook_request_id": null,
9
"flow_action_run_id": null,
10
"run": {
11
"id": "2a0af1ac-3931-4478-abc7-11111",
12
"result": null,
13
"result_meta": {
14
"shopify_admin_api_time_ms": 0,
15
"shopify_admin_graphql_api_cost": 0,
16
"shopify_admin_rest_api_requests_count": 0,
17
"shopify_admin_graphql_api_requests_count": 0
18
},
19
"error": null,
20
"ok": true,
21
"started_at": "2023-06-13T17:03:39.118Z",
22
"stopped_at": "2023-06-13T17:03:39.126Z",
23
"elapsed_time_ms": 7,
24
"run_at": "2023-06-13T17:03:27.249Z",
25
"enqueued_at": "2023-06-13T17:03:27.410Z",
26
"attempts": 1
27
}
28
},
29
"task": {
30
"id": "1250304e-313c-49a2-acc2-111111",
31
"name": "Test Draft order",
32
"event_topics": [
33
"mechanic/user/trigger",
34
"mechanic/actions/perform"
35
],
36
"options": {},
37
"script": "{% if event.topic == \"mechanic/user/trigger\" or event.preview %} \n {% action \"shopify\" %}\n [\n \"create\",\n \"draft_order\",\n {\n \"customer\": {\n \"id\": 1111\n },\n \"line_items\": []\n }\n ]\n{% endaction %}\n\n{% else %}\n\n{% action \"echo\" action.result %}\n \n{% endif %}\n",
38
"created_at": "2023-06-13T16:50:28.950Z",
39
"updated_at": "2023-06-13T17:03:22.946Z",
40
"subscriptions": [
41
"mechanic/user/trigger",
42
"mechanic/actions/perform"
43
],
44
"enabled": true,
45
"online_store_javascript": null,
46
"order_status_javascript": null,
47
"docs": null,
48
"shopify_access_scopes_required": [
49
"write_draft_orders"
50
],
51
"subscriptions_template": "mechanic/user/trigger\nmechanic/actions/perform",
52
"shopify_api_version": "2023-04",
53
"liquid_profiling": false,
54
"perform_action_runs_in_sequence": false,
55
"halt_action_run_sequence_on_error": false,
56
"run": {
57
"id": "292a750b-2687-498f-8616-1223",
58
"error": null,
59
"ok": true,
60
"started_at": "2023-06-13T17:03:49.284Z",
61
"stopped_at": "2023-06-13T17:03:49.291Z",
62
"elapsed_time_ms": 6,
63
"run_at": "2023-06-13T17:03:39.125Z",
64
"enqueued_at": "2023-06-13T17:03:39.286Z",
65
"result_meta": {
66
"shopify_admin_api_time_ms": 0,
67
"shopify_admin_graphql_api_cost": 0,
68
"shopify_admin_rest_api_requests_count": 0,
69
"shopify_admin_graphql_api_requests_count": 0
70
},
71
"attempts": 1
72
}
73
},
74
"action": {
75
"type": "shopify",
76
"options": [
77
"create",
78
"draft_order",
79
{
80
"customer": {
81
"id": 12344
82
},
83
"line_items": []
84
}
85
],
86
"meta": null,
87
"run": {
88
"id": "d60820a4-d9d0-43a8-a56e-11111",
89
"result": null,
90
"error": "Received a Shopify error (resource invalid): Add at least 1 product",
91
"ok": false,
92
"started_at": "2023-06-13T17:03:56.770Z",
93
"stopped_at": "2023-06-13T17:03:57.075Z",
94
"elapsed_time_ms": 304,
95
"run_at": "2023-06-13T17:03:49.289Z",
96
"enqueued_at": "2023-06-13T17:03:49.513Z",
97
"result_meta": {
98
"shopify_admin_graphql_api_cost": 0,
99
"shopify_admin_graphql_api_requests_count": 0,
100
"shopify_admin_rest_api_requests_count": 1,
101
"shopify_admin_api_time_ms": 295.04
102
},
103
"attempts": 1
104
}
105
}
106
}
Last modified 3mo ago