@deployanyway/error-translator 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/MIGRATION.md +6 -0
- package/README.md +67 -9
- package/dist/index.cjs +524 -0
- package/index.d.cts +2 -0
- package/index.d.ts +2 -0
- package/package.json +1 -1
- package/src/cli.js +16 -1
- package/src/definitions.js +2 -0
- package/src/extra-definitions.js +494 -0
- package/src/index.js +54 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
46 built-in definitions cover filesystem, permissions, networking, module loading, streams, HTTP response lifecycle and JavaScript errors. Each has a specific explanation, likely causes and practical checks. Rubber-duck commentary has a distinct original line for every supported definition. No commands run automatically and unknown errors remain explicitly unrecognized.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
|
|
9
|
+
|
|
3
10
|
## 0.3.0 — 2026-10-08
|
|
4
11
|
|
|
5
12
|
- Useful structured API/CLI additions described in README.
|
|
@@ -22,3 +29,4 @@
|
|
|
22
29
|
- Plain-English translations for ECONNREFUSED, ENOENT, EADDRINUSE, MODULE_NOT_FOUND, ERR_MODULE_NOT_FOUND, and TypeError.
|
|
23
30
|
- Structured results, text rendering, and CLI with JSON output.
|
|
24
31
|
- Automated tests, linting, formatting, and Node 22/24 CI.
|
|
32
|
+
```
|
package/MIGRATION.md
CHANGED
|
@@ -3,3 +3,9 @@
|
|
|
3
3
|
Node 22.13+ is required. Existing core APIs remain available; TypeScript declarations and CommonJS exports are new. The CLI now lives in src/cli.js behind the same executable path. Input/stdout behavior for new options is documented in README.
|
|
4
4
|
|
|
5
5
|
Install 0.3.0 with npm. Seeds and exact humorous wording are version-specific. Do not treat jokes or heuristic scores as production evidence.
|
|
6
|
+
|
|
7
|
+
## 0.3.0 to 0.4.0
|
|
8
|
+
|
|
9
|
+
46 distinct error definitions with explanations, causes and practical checks; original duck commentary for each; structured errorCatalog API and --catalog CLI.
|
|
10
|
+
|
|
11
|
+
Default behavior is retained except that the expanded error catalog now recognizes additional errors. New rotation and release-plan features are opt-in.
|
package/README.md
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
# error-translator
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Browse the debugging library (0.4.0)
|
|
4
|
+
|
|
5
|
+
46 built-in definitions cover filesystem, permissions, networking, module loading, streams, HTTP response lifecycle and JavaScript errors. Each has a specific explanation, likely causes and practical checks. Rubber-duck commentary has a distinct original line for every supported definition. No commands run automatically and unknown errors remain explicitly unrecognized.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npx @deployanyway/error-translator ERR_HTTP_HEADERS_SENT --mode rubber-duck
|
|
9
|
+
npx @deployanyway/error-translator --catalog --json
|
|
10
|
+
npx @deployanyway/error-translator --list
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
import { errorCatalog, translateError } from "@deployanyway/error-translator";
|
|
15
|
+
console.log(errorCatalog({ mode: "plain" }));
|
|
16
|
+
console.log(translateError({ code: "EACCES", message: "open config.json" }));
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`errorCatalog(options?)` returns independent structured translations for the complete catalog. `--catalog` prints all guidance, or JSON with `--json`. Explicit codes still take precedence over message matching. This is a focused Node/JavaScript debugging catalog, not diagnosis of every platform or framework error. Technical reference: https://nodejs.org/api/errors.html.
|
|
20
|
+
|
|
21
|
+
> **Version 0.4.0:** install from npm with Node 22.13+ or Node 24. See MIGRATION.md for changes from 0.2.0.
|
|
4
22
|
|
|
5
23
|
[](https://www.npmjs.com/package/@deployanyway/error-translator)
|
|
6
24
|
[](https://github.com/DeployAnyway/error-translator/actions/workflows/ci.yml)
|
|
@@ -84,14 +102,54 @@ Invalid result shapes throw TypeError.
|
|
|
84
102
|
|
|
85
103
|
### Built-in errors
|
|
86
104
|
|
|
87
|
-
| Code/name
|
|
88
|
-
|
|
|
89
|
-
|
|
|
90
|
-
|
|
|
91
|
-
|
|
|
92
|
-
|
|
|
93
|
-
|
|
|
94
|
-
|
|
|
105
|
+
| Code/name | Guidance |
|
|
106
|
+
| ------------------------------ | --------------------------------- |
|
|
107
|
+
| EACCES | Permission denied |
|
|
108
|
+
| EPERM | Operation not permitted |
|
|
109
|
+
| EEXIST | Target already exists |
|
|
110
|
+
| ENOTDIR | Expected a directory |
|
|
111
|
+
| EISDIR | Expected a file |
|
|
112
|
+
| ENOTEMPTY | Directory is not empty |
|
|
113
|
+
| EMFILE | Too many open files |
|
|
114
|
+
| ENFILE | System file table exhausted |
|
|
115
|
+
| ENOSPC | No space left |
|
|
116
|
+
| EROFS | Read-only filesystem |
|
|
117
|
+
| EBUSY | Resource busy |
|
|
118
|
+
| EXDEV | Cross-device operation |
|
|
119
|
+
| EPIPE | Broken pipe |
|
|
120
|
+
| ECONNRESET | Connection reset |
|
|
121
|
+
| ETIMEDOUT | Operation timed out |
|
|
122
|
+
| ENOTFOUND | Name lookup failed |
|
|
123
|
+
| EAI_AGAIN | Temporary name lookup failure |
|
|
124
|
+
| EADDRNOTAVAIL | Local address unavailable |
|
|
125
|
+
| ECONNABORTED | Connection aborted |
|
|
126
|
+
| ENETUNREACH | Network unreachable |
|
|
127
|
+
| EHOSTUNREACH | Host unreachable |
|
|
128
|
+
| EINVAL | Invalid argument |
|
|
129
|
+
| ABORT_ERR | Operation aborted |
|
|
130
|
+
| ERR_INVALID_ARG_TYPE | Wrong argument type |
|
|
131
|
+
| ERR_INVALID_ARG_VALUE | Invalid argument value |
|
|
132
|
+
| ERR_OUT_OF_RANGE | Value outside allowed range |
|
|
133
|
+
| ERR_HTTP_HEADERS_SENT | Headers already sent |
|
|
134
|
+
| ERR_HTTP_INVALID_STATUS_CODE | Invalid HTTP status |
|
|
135
|
+
| ERR_INVALID_URL | Invalid URL |
|
|
136
|
+
| ERR_PACKAGE_PATH_NOT_EXPORTED | Package path not exported |
|
|
137
|
+
| ERR_PACKAGE_IMPORT_NOT_DEFINED | Package import not defined |
|
|
138
|
+
| ERR_INVALID_PACKAGE_CONFIG | Invalid package configuration |
|
|
139
|
+
| ERR_UNKNOWN_FILE_EXTENSION | Unknown module file extension |
|
|
140
|
+
| ERR_IMPORT_ATTRIBUTE_MISSING | Required import attribute missing |
|
|
141
|
+
| ERR_STREAM_WRITE_AFTER_END | Write after stream end |
|
|
142
|
+
| ERR_STREAM_DESTROYED | Stream destroyed |
|
|
143
|
+
| ERR_SOCKET_BAD_PORT | Invalid socket port |
|
|
144
|
+
| SyntaxError | Invalid JavaScript syntax |
|
|
145
|
+
| ReferenceError | Name is not available |
|
|
146
|
+
| RangeError | Value exceeds a permitted range |
|
|
147
|
+
| ECONNREFUSED | Connection refused |
|
|
148
|
+
| ENOENT | File or directory not found |
|
|
149
|
+
| EADDRINUSE | Address already in use |
|
|
150
|
+
| MODULE_NOT_FOUND | Module not found |
|
|
151
|
+
| ERR_MODULE_NOT_FOUND | ES module not found |
|
|
152
|
+
| TypeError | Unexpected value type |
|
|
95
153
|
|
|
96
154
|
Translations describe likely causes, not a diagnosis. Keep the original error
|
|
97
155
|
and stack trace for context. No AI API or remote service is used.
|
package/dist/index.cjs
CHANGED
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.js
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
errorCatalog: () => errorCatalog,
|
|
23
24
|
listErrors: () => listErrors,
|
|
24
25
|
renderTranslation: () => renderTranslation,
|
|
25
26
|
translateError: () => translateError,
|
|
@@ -27,8 +28,487 @@ __export(index_exports, {
|
|
|
27
28
|
});
|
|
28
29
|
module.exports = __toCommonJS(index_exports);
|
|
29
30
|
|
|
31
|
+
// src/extra-definitions.js
|
|
32
|
+
var extraDefinitions = {
|
|
33
|
+
EACCES: {
|
|
34
|
+
title: "Permission denied",
|
|
35
|
+
explanation: "The process lacks permission for the requested operation.",
|
|
36
|
+
likelyCauses: [
|
|
37
|
+
"A directory or file belongs to another account",
|
|
38
|
+
"The application runs under a restricted service identity"
|
|
39
|
+
],
|
|
40
|
+
suggestions: [
|
|
41
|
+
"Check the service identity and permissions on each parent directory.",
|
|
42
|
+
"Grant only the access the application needs; avoid running everything as administrator."
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
EPERM: {
|
|
46
|
+
title: "Operation not permitted",
|
|
47
|
+
explanation: "The operating system rejected an operation even though the target may exist.",
|
|
48
|
+
likelyCauses: [
|
|
49
|
+
"A protected resource or locked file",
|
|
50
|
+
"An operation forbidden by the current platform or identity"
|
|
51
|
+
],
|
|
52
|
+
suggestions: [
|
|
53
|
+
"Inspect the operation, ownership and platform restrictions.",
|
|
54
|
+
"Close the process holding the resource and retry only if the operation is intended."
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
EEXIST: {
|
|
58
|
+
title: "Target already exists",
|
|
59
|
+
explanation: "A creation operation requires a new target, but that target already exists.",
|
|
60
|
+
likelyCauses: ["A repeated initialization step", "A filename collision"],
|
|
61
|
+
suggestions: [
|
|
62
|
+
"Check the target before creating it and make initialization idempotent.",
|
|
63
|
+
"Use a distinct name rather than deleting an existing target blindly."
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
ENOTDIR: {
|
|
67
|
+
title: "Expected a directory",
|
|
68
|
+
explanation: "A path component used as a directory is actually another kind of file.",
|
|
69
|
+
likelyCauses: [
|
|
70
|
+
"A file appears in the middle of the path",
|
|
71
|
+
"A configuration value points to the wrong target"
|
|
72
|
+
],
|
|
73
|
+
suggestions: [
|
|
74
|
+
"Inspect each path component and its type.",
|
|
75
|
+
"Correct the directory configuration before retrying."
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
EISDIR: {
|
|
79
|
+
title: "Expected a file",
|
|
80
|
+
explanation: "The operation received a directory where it expected a file.",
|
|
81
|
+
likelyCauses: [
|
|
82
|
+
"The filename is missing from a configured path",
|
|
83
|
+
"A directory was passed to a file operation"
|
|
84
|
+
],
|
|
85
|
+
suggestions: [
|
|
86
|
+
"Check the complete path and inspect the target type.",
|
|
87
|
+
"Use the appropriate directory API when working with directories."
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
ENOTEMPTY: {
|
|
91
|
+
title: "Directory is not empty",
|
|
92
|
+
explanation: "A directory operation requires an empty target, but entries remain.",
|
|
93
|
+
likelyCauses: [
|
|
94
|
+
"Generated files remain in the directory",
|
|
95
|
+
"Another process is still writing files"
|
|
96
|
+
],
|
|
97
|
+
suggestions: [
|
|
98
|
+
"List the remaining entries and identify their owner.",
|
|
99
|
+
"Remove only confirmed disposable content or choose a new directory."
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
EMFILE: {
|
|
103
|
+
title: "Too many open files",
|
|
104
|
+
explanation: "The process has exhausted its available file descriptors.",
|
|
105
|
+
likelyCauses: [
|
|
106
|
+
"Handles are not closed",
|
|
107
|
+
"Too many files or sockets are opened concurrently"
|
|
108
|
+
],
|
|
109
|
+
suggestions: [
|
|
110
|
+
"Close handles in cleanup paths and bound concurrent work.",
|
|
111
|
+
"Inspect descriptor usage before considering a higher process limit."
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
ENFILE: {
|
|
115
|
+
title: "System file table exhausted",
|
|
116
|
+
explanation: "The system cannot allocate another file handle.",
|
|
117
|
+
likelyCauses: [
|
|
118
|
+
"Many processes hold open files",
|
|
119
|
+
"The host has reached a system resource limit"
|
|
120
|
+
],
|
|
121
|
+
suggestions: [
|
|
122
|
+
"Inspect host-wide handle usage and identify runaway processes.",
|
|
123
|
+
"Reduce concurrency and resolve leaks before changing system limits."
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
ENOSPC: {
|
|
127
|
+
title: "No space left",
|
|
128
|
+
explanation: "The filesystem cannot allocate the space or resources required by the operation.",
|
|
129
|
+
likelyCauses: [
|
|
130
|
+
"The volume is full",
|
|
131
|
+
"Filesystem quotas or resource limits are exhausted"
|
|
132
|
+
],
|
|
133
|
+
suggestions: [
|
|
134
|
+
"Check free space, quotas and the volume receiving the write.",
|
|
135
|
+
"Clear verified disposable data and investigate rapid growth."
|
|
136
|
+
]
|
|
137
|
+
},
|
|
138
|
+
EROFS: {
|
|
139
|
+
title: "Read-only filesystem",
|
|
140
|
+
explanation: "The target filesystem does not permit writes.",
|
|
141
|
+
likelyCauses: [
|
|
142
|
+
"A read-only container mount",
|
|
143
|
+
"A protected or recovery-mounted volume"
|
|
144
|
+
],
|
|
145
|
+
suggestions: [
|
|
146
|
+
"Inspect mount settings and choose an intended writable data location.",
|
|
147
|
+
"Change mount configuration only when the write is part of the deployment design."
|
|
148
|
+
]
|
|
149
|
+
},
|
|
150
|
+
EBUSY: {
|
|
151
|
+
title: "Resource busy",
|
|
152
|
+
explanation: "A resource cannot complete the requested operation while another operation holds it.",
|
|
153
|
+
likelyCauses: [
|
|
154
|
+
"A mounted or open resource",
|
|
155
|
+
"A concurrent operation has not finished"
|
|
156
|
+
],
|
|
157
|
+
suggestions: [
|
|
158
|
+
"Identify the process or operation holding the resource.",
|
|
159
|
+
"Wait for its completion or coordinate ownership instead of looping without a limit."
|
|
160
|
+
]
|
|
161
|
+
},
|
|
162
|
+
EXDEV: {
|
|
163
|
+
title: "Cross-device operation",
|
|
164
|
+
explanation: "An operation such as a rename crosses filesystem boundaries that it cannot cross directly.",
|
|
165
|
+
likelyCauses: [
|
|
166
|
+
"Temporary and destination files live on different volumes",
|
|
167
|
+
"A container mount creates a filesystem boundary"
|
|
168
|
+
],
|
|
169
|
+
suggestions: [
|
|
170
|
+
"Create temporary files on the destination filesystem when atomic rename is required.",
|
|
171
|
+
"Use an intentional copy-and-cleanup workflow when atomic movement is unnecessary."
|
|
172
|
+
]
|
|
173
|
+
},
|
|
174
|
+
EPIPE: {
|
|
175
|
+
title: "Broken pipe",
|
|
176
|
+
explanation: "The application wrote to a stream whose receiving end has closed.",
|
|
177
|
+
likelyCauses: [
|
|
178
|
+
"A downstream command exited",
|
|
179
|
+
"A peer disconnected before the write completed"
|
|
180
|
+
],
|
|
181
|
+
suggestions: [
|
|
182
|
+
"Handle stream errors and stop producing data when the consumer closes.",
|
|
183
|
+
"Distinguish an expected pipeline close from an unexpected connection failure."
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
ECONNRESET: {
|
|
187
|
+
title: "Connection reset",
|
|
188
|
+
explanation: "A connection was forcibly closed while the application was using it.",
|
|
189
|
+
likelyCauses: [
|
|
190
|
+
"The remote peer closed the connection",
|
|
191
|
+
"An intermediary interrupted the session"
|
|
192
|
+
],
|
|
193
|
+
suggestions: [
|
|
194
|
+
"Inspect peer logs, timeout settings and recent connection changes.",
|
|
195
|
+
"Retry only safe operations with a bounded backoff and avoid duplicate side effects."
|
|
196
|
+
]
|
|
197
|
+
},
|
|
198
|
+
ETIMEDOUT: {
|
|
199
|
+
title: "Operation timed out",
|
|
200
|
+
explanation: "A connection or operation did not finish within its allowed time.",
|
|
201
|
+
likelyCauses: [
|
|
202
|
+
"An unreachable or slow peer",
|
|
203
|
+
"A timeout shorter than the expected operation"
|
|
204
|
+
],
|
|
205
|
+
suggestions: [
|
|
206
|
+
"Check network reachability, service latency and the configured timeout.",
|
|
207
|
+
"Use bounded retries only for operations that are safe to repeat."
|
|
208
|
+
]
|
|
209
|
+
},
|
|
210
|
+
ENOTFOUND: {
|
|
211
|
+
title: "Name lookup failed",
|
|
212
|
+
explanation: "The requested hostname could not be resolved by the lookup operation.",
|
|
213
|
+
likelyCauses: [
|
|
214
|
+
"A misspelled hostname",
|
|
215
|
+
"Resolver configuration or lookup resources failed"
|
|
216
|
+
],
|
|
217
|
+
suggestions: [
|
|
218
|
+
"Check the exact hostname and DNS behavior from the same runtime environment.",
|
|
219
|
+
"Do not assume every lookup failure proves the hostname does not exist."
|
|
220
|
+
]
|
|
221
|
+
},
|
|
222
|
+
EAI_AGAIN: {
|
|
223
|
+
title: "Temporary name lookup failure",
|
|
224
|
+
explanation: "Name resolution reported a temporary failure.",
|
|
225
|
+
likelyCauses: [
|
|
226
|
+
"A resolver is temporarily unavailable",
|
|
227
|
+
"A transient network or DNS problem"
|
|
228
|
+
],
|
|
229
|
+
suggestions: [
|
|
230
|
+
"Check the resolver and network from the affected host.",
|
|
231
|
+
"Apply bounded retry with backoff and report persistent failures."
|
|
232
|
+
]
|
|
233
|
+
},
|
|
234
|
+
EADDRNOTAVAIL: {
|
|
235
|
+
title: "Local address unavailable",
|
|
236
|
+
explanation: "The application tried to use an address that is not available on the local system.",
|
|
237
|
+
likelyCauses: [
|
|
238
|
+
"Binding to an address on another host",
|
|
239
|
+
"An interface address changed"
|
|
240
|
+
],
|
|
241
|
+
suggestions: [
|
|
242
|
+
"Inspect local interfaces and the configured bind address.",
|
|
243
|
+
"Use the intended local interface rather than a remote destination address."
|
|
244
|
+
]
|
|
245
|
+
},
|
|
246
|
+
ECONNABORTED: {
|
|
247
|
+
title: "Connection aborted",
|
|
248
|
+
explanation: "A connection was aborted before the operation completed.",
|
|
249
|
+
likelyCauses: [
|
|
250
|
+
"A connection failure during setup or transfer",
|
|
251
|
+
"A local or intermediary cancellation"
|
|
252
|
+
],
|
|
253
|
+
suggestions: [
|
|
254
|
+
"Inspect the failure timing and both ends of the connection.",
|
|
255
|
+
"Handle cancellation separately from application errors when appropriate."
|
|
256
|
+
]
|
|
257
|
+
},
|
|
258
|
+
ENETUNREACH: {
|
|
259
|
+
title: "Network unreachable",
|
|
260
|
+
explanation: "The host has no usable route to the requested network.",
|
|
261
|
+
likelyCauses: [
|
|
262
|
+
"Missing route or disconnected interface",
|
|
263
|
+
"Network isolation in a container or host"
|
|
264
|
+
],
|
|
265
|
+
suggestions: [
|
|
266
|
+
"Inspect connectivity and routing in the application environment.",
|
|
267
|
+
"Confirm the destination network is intended to be reachable."
|
|
268
|
+
]
|
|
269
|
+
},
|
|
270
|
+
EHOSTUNREACH: {
|
|
271
|
+
title: "Host unreachable",
|
|
272
|
+
explanation: "The destination host could not be reached through the available network path.",
|
|
273
|
+
likelyCauses: [
|
|
274
|
+
"The destination is unavailable",
|
|
275
|
+
"Routing or filtering blocks the path"
|
|
276
|
+
],
|
|
277
|
+
suggestions: [
|
|
278
|
+
"Check the destination address and routing from the affected host.",
|
|
279
|
+
"Inspect network policy rather than disabling protection blindly."
|
|
280
|
+
]
|
|
281
|
+
},
|
|
282
|
+
EINVAL: {
|
|
283
|
+
title: "Invalid argument",
|
|
284
|
+
explanation: "The operating system rejected an argument to the operation.",
|
|
285
|
+
likelyCauses: [
|
|
286
|
+
"A value outside the operation contract",
|
|
287
|
+
"A platform-specific unsupported value"
|
|
288
|
+
],
|
|
289
|
+
suggestions: [
|
|
290
|
+
"Inspect the syscall and the exact values passed to it.",
|
|
291
|
+
"Validate values against the API and platform requirements."
|
|
292
|
+
]
|
|
293
|
+
},
|
|
294
|
+
ABORT_ERR: {
|
|
295
|
+
title: "Operation aborted",
|
|
296
|
+
explanation: "An operation was cancelled through an abort mechanism.",
|
|
297
|
+
likelyCauses: [
|
|
298
|
+
"An AbortSignal was triggered",
|
|
299
|
+
"A caller timeout cancelled the operation"
|
|
300
|
+
],
|
|
301
|
+
suggestions: [
|
|
302
|
+
"Inspect who owns the abort controller and when cancellation occurred.",
|
|
303
|
+
"Treat expected cancellation separately and clean up resources."
|
|
304
|
+
]
|
|
305
|
+
},
|
|
306
|
+
ERR_INVALID_ARG_TYPE: {
|
|
307
|
+
title: "Wrong argument type",
|
|
308
|
+
explanation: "A Node API received an argument of the wrong type.",
|
|
309
|
+
likelyCauses: [
|
|
310
|
+
"A missing or incorrect value",
|
|
311
|
+
"An unexpected return type passed to another API"
|
|
312
|
+
],
|
|
313
|
+
suggestions: [
|
|
314
|
+
"Read the parameter name in the error and inspect its actual value.",
|
|
315
|
+
"Validate the argument at the boundary where it enters your application."
|
|
316
|
+
]
|
|
317
|
+
},
|
|
318
|
+
ERR_INVALID_ARG_VALUE: {
|
|
319
|
+
title: "Invalid argument value",
|
|
320
|
+
explanation: "An argument has a value the API does not accept.",
|
|
321
|
+
likelyCauses: [
|
|
322
|
+
"A valid type with an unsupported value",
|
|
323
|
+
"An invalid option combination"
|
|
324
|
+
],
|
|
325
|
+
suggestions: [
|
|
326
|
+
"Inspect the named parameter and documented accepted values.",
|
|
327
|
+
"Validate options before calling the API."
|
|
328
|
+
]
|
|
329
|
+
},
|
|
330
|
+
ERR_OUT_OF_RANGE: {
|
|
331
|
+
title: "Value outside allowed range",
|
|
332
|
+
explanation: "A numeric or size argument falls outside the API range.",
|
|
333
|
+
likelyCauses: [
|
|
334
|
+
"An invalid offset or length",
|
|
335
|
+
"A computed limit exceeds the supported bounds"
|
|
336
|
+
],
|
|
337
|
+
suggestions: [
|
|
338
|
+
"Check the reported minimum and maximum and the calculation producing the value.",
|
|
339
|
+
"Add boundary tests for zero, limits and oversized input."
|
|
340
|
+
]
|
|
341
|
+
},
|
|
342
|
+
ERR_HTTP_HEADERS_SENT: {
|
|
343
|
+
title: "Headers already sent",
|
|
344
|
+
explanation: "The server tried to change headers after the response headers had been sent.",
|
|
345
|
+
likelyCauses: [
|
|
346
|
+
"Two code paths respond to the same request",
|
|
347
|
+
"An asynchronous callback runs after the response is complete"
|
|
348
|
+
],
|
|
349
|
+
suggestions: [
|
|
350
|
+
"Trace every response path and return after sending the response.",
|
|
351
|
+
"Coordinate asynchronous work so only one path owns the final response."
|
|
352
|
+
]
|
|
353
|
+
},
|
|
354
|
+
ERR_HTTP_INVALID_STATUS_CODE: {
|
|
355
|
+
title: "Invalid HTTP status",
|
|
356
|
+
explanation: "The response status code is outside the accepted API range.",
|
|
357
|
+
likelyCauses: [
|
|
358
|
+
"An undefined value becomes a status",
|
|
359
|
+
"A business code is mistaken for an HTTP status"
|
|
360
|
+
],
|
|
361
|
+
suggestions: [
|
|
362
|
+
"Check the status value before assigning or sending it.",
|
|
363
|
+
"Keep internal result codes separate from HTTP status codes."
|
|
364
|
+
]
|
|
365
|
+
},
|
|
366
|
+
ERR_INVALID_URL: {
|
|
367
|
+
title: "Invalid URL",
|
|
368
|
+
explanation: "The URL parser cannot interpret the supplied URL.",
|
|
369
|
+
likelyCauses: [
|
|
370
|
+
"A malformed absolute URL",
|
|
371
|
+
"A relative URL without a valid base"
|
|
372
|
+
],
|
|
373
|
+
suggestions: [
|
|
374
|
+
"Inspect the original input and supply an explicit base for relative paths.",
|
|
375
|
+
"Validate user-controlled URL inputs before making requests."
|
|
376
|
+
]
|
|
377
|
+
},
|
|
378
|
+
ERR_PACKAGE_PATH_NOT_EXPORTED: {
|
|
379
|
+
title: "Package path not exported",
|
|
380
|
+
explanation: "A package exports map does not expose the requested subpath.",
|
|
381
|
+
likelyCauses: [
|
|
382
|
+
"Importing an internal package file",
|
|
383
|
+
"A dependency changed its public entry points"
|
|
384
|
+
],
|
|
385
|
+
suggestions: [
|
|
386
|
+
"Inspect the package exports and use a documented public entry.",
|
|
387
|
+
"Upgrade or pin compatible dependencies instead of relying on private paths."
|
|
388
|
+
]
|
|
389
|
+
},
|
|
390
|
+
ERR_PACKAGE_IMPORT_NOT_DEFINED: {
|
|
391
|
+
title: "Package import not defined",
|
|
392
|
+
explanation: "A package imports map has no matching internal specifier.",
|
|
393
|
+
likelyCauses: [
|
|
394
|
+
"A missing imports mapping",
|
|
395
|
+
"A specifier is used outside its intended package scope"
|
|
396
|
+
],
|
|
397
|
+
suggestions: [
|
|
398
|
+
"Check package.json imports and the exact specifier.",
|
|
399
|
+
"Keep internal import aliases inside the package that defines them."
|
|
400
|
+
]
|
|
401
|
+
},
|
|
402
|
+
ERR_INVALID_PACKAGE_CONFIG: {
|
|
403
|
+
title: "Invalid package configuration",
|
|
404
|
+
explanation: "Node could not use the package configuration.",
|
|
405
|
+
likelyCauses: ["Malformed package.json", "An invalid configuration field"],
|
|
406
|
+
suggestions: [
|
|
407
|
+
"Read the named package.json and validate its JSON and relevant fields.",
|
|
408
|
+
"Check the first configuration error before reinstalling dependencies."
|
|
409
|
+
]
|
|
410
|
+
},
|
|
411
|
+
ERR_UNKNOWN_FILE_EXTENSION: {
|
|
412
|
+
title: "Unknown module file extension",
|
|
413
|
+
explanation: "The module loader does not recognize the file extension in this context.",
|
|
414
|
+
likelyCauses: [
|
|
415
|
+
"An unsupported file type is imported",
|
|
416
|
+
"The required build or loader is missing"
|
|
417
|
+
],
|
|
418
|
+
suggestions: [
|
|
419
|
+
"Check the imported extension and the runtime module configuration.",
|
|
420
|
+
"Compile to a supported format or use a documented loader setup."
|
|
421
|
+
]
|
|
422
|
+
},
|
|
423
|
+
ERR_IMPORT_ATTRIBUTE_MISSING: {
|
|
424
|
+
title: "Required import attribute missing",
|
|
425
|
+
explanation: "A module import requires an attribute that was not provided.",
|
|
426
|
+
likelyCauses: [
|
|
427
|
+
"A JSON import lacks the required type attribute",
|
|
428
|
+
"An import was copied from a different runtime version"
|
|
429
|
+
],
|
|
430
|
+
suggestions: [
|
|
431
|
+
"Check the module type and import syntax for your supported Node version.",
|
|
432
|
+
"Use the required import attributes or an appropriate file-reading API."
|
|
433
|
+
]
|
|
434
|
+
},
|
|
435
|
+
ERR_STREAM_WRITE_AFTER_END: {
|
|
436
|
+
title: "Write after stream end",
|
|
437
|
+
explanation: "Data was written after the writable stream had ended.",
|
|
438
|
+
likelyCauses: [
|
|
439
|
+
"A late callback writes to a closed stream",
|
|
440
|
+
"Multiple owners end and write the same stream"
|
|
441
|
+
],
|
|
442
|
+
suggestions: [
|
|
443
|
+
"Trace the stream lifecycle and coordinate the writer with completion.",
|
|
444
|
+
"Test delayed callbacks and ensure end is called once work is complete."
|
|
445
|
+
]
|
|
446
|
+
},
|
|
447
|
+
ERR_STREAM_DESTROYED: {
|
|
448
|
+
title: "Stream destroyed",
|
|
449
|
+
explanation: "An operation used a stream after it had been destroyed.",
|
|
450
|
+
likelyCauses: [
|
|
451
|
+
"A prior error destroyed the stream",
|
|
452
|
+
"Cleanup ran while work was still pending"
|
|
453
|
+
],
|
|
454
|
+
suggestions: [
|
|
455
|
+
"Inspect the original stream error and cancellation timing.",
|
|
456
|
+
"Stop dependent work when the stream closes or is destroyed."
|
|
457
|
+
]
|
|
458
|
+
},
|
|
459
|
+
ERR_SOCKET_BAD_PORT: {
|
|
460
|
+
title: "Invalid socket port",
|
|
461
|
+
explanation: "A socket port value is not accepted by the API.",
|
|
462
|
+
likelyCauses: [
|
|
463
|
+
"A malformed environment variable",
|
|
464
|
+
"A number outside the port range"
|
|
465
|
+
],
|
|
466
|
+
suggestions: [
|
|
467
|
+
"Validate and parse the port configuration before creating the connection.",
|
|
468
|
+
"Do not substitute a silent default for a visibly invalid production setting."
|
|
469
|
+
]
|
|
470
|
+
},
|
|
471
|
+
SyntaxError: {
|
|
472
|
+
title: "Invalid JavaScript syntax",
|
|
473
|
+
explanation: "The parser cannot interpret the source or input syntax.",
|
|
474
|
+
likelyCauses: [
|
|
475
|
+
"Malformed JavaScript or JSON",
|
|
476
|
+
"Syntax unsupported by the current runtime"
|
|
477
|
+
],
|
|
478
|
+
suggestions: [
|
|
479
|
+
"Read the first reported location and inspect nearby delimiters and tokens.",
|
|
480
|
+
"Confirm the input format and runtime version before changing unrelated code."
|
|
481
|
+
]
|
|
482
|
+
},
|
|
483
|
+
ReferenceError: {
|
|
484
|
+
title: "Name is not available",
|
|
485
|
+
explanation: "An expression refers to a binding that is not available in its current scope or initialization state.",
|
|
486
|
+
likelyCauses: [
|
|
487
|
+
"A misspelled or out-of-scope variable",
|
|
488
|
+
"Access before initialization"
|
|
489
|
+
],
|
|
490
|
+
suggestions: [
|
|
491
|
+
"Inspect the referenced name and its scope at the reported line.",
|
|
492
|
+
"Check initialization order and add a focused regression test."
|
|
493
|
+
]
|
|
494
|
+
},
|
|
495
|
+
RangeError: {
|
|
496
|
+
title: "Value exceeds a permitted range",
|
|
497
|
+
explanation: "An operation received a value outside its allowed range or exhausted a range-related resource.",
|
|
498
|
+
likelyCauses: [
|
|
499
|
+
"An invalid numeric size or index",
|
|
500
|
+
"Excessive recursion or allocation"
|
|
501
|
+
],
|
|
502
|
+
suggestions: [
|
|
503
|
+
"Read the exact message to distinguish numeric bounds from stack exhaustion.",
|
|
504
|
+
"Inspect boundary values and recursion termination rather than treating every RangeError alike."
|
|
505
|
+
]
|
|
506
|
+
}
|
|
507
|
+
};
|
|
508
|
+
|
|
30
509
|
// src/definitions.js
|
|
31
510
|
var definitions = {
|
|
511
|
+
...extraDefinitions,
|
|
32
512
|
ECONNREFUSED: {
|
|
33
513
|
title: "Connection refused",
|
|
34
514
|
explanation: "The application tried to connect to a service, but nothing accepted the connection.",
|
|
@@ -114,6 +594,46 @@ function translateErrors(errors, options = {}) {
|
|
|
114
594
|
return Array.from(errors, (error) => translateError(error, options));
|
|
115
595
|
}
|
|
116
596
|
var duckLines = {
|
|
597
|
+
EACCES: "The file has a guest list. Your process is not on it.",
|
|
598
|
+
EPERM: "The operating system has declined your ambitious proposal.",
|
|
599
|
+
EEXIST: "The target is already here and has not agreed to be replaced.",
|
|
600
|
+
ENOTDIR: "That hallway is actually a cupboard.",
|
|
601
|
+
EISDIR: "You asked for one file and received the whole neighborhood.",
|
|
602
|
+
ENOTEMPTY: "The directory still has roommates.",
|
|
603
|
+
EMFILE: "Your process opened every door and forgot to close them.",
|
|
604
|
+
ENFILE: "The host has run out of chairs for file handles.",
|
|
605
|
+
ENOSPC: "The disk has eaten the final snack.",
|
|
606
|
+
EROFS: "This filesystem is a museum: look, but do not rearrange.",
|
|
607
|
+
EBUSY: "The resource is in another meeting.",
|
|
608
|
+
EXDEV: "The rename has reached the border and needs a different passport.",
|
|
609
|
+
EPIPE: "The audience left before your stream finished the speech.",
|
|
610
|
+
ECONNRESET: "The other end hung up without the usual pleasantries.",
|
|
611
|
+
ETIMEDOUT: "The operation is late and has not brought a believable excuse.",
|
|
612
|
+
ENOTFOUND: "The hostname is not answering roll call.",
|
|
613
|
+
EAI_AGAIN: "DNS requests a brief intermission, not eternal optimism.",
|
|
614
|
+
EADDRNOTAVAIL: "That address does not live on this machine.",
|
|
615
|
+
ECONNABORTED: "The connection left before the conversation was finished.",
|
|
616
|
+
ENETUNREACH: "The packet has no road to the destination.",
|
|
617
|
+
EHOSTUNREACH: "The route exists; the destination is still playing hard to reach.",
|
|
618
|
+
EINVAL: "The argument has failed the entrance interview.",
|
|
619
|
+
ABORT_ERR: "The caller pulled the emergency stop. Ask why before restarting.",
|
|
620
|
+
ERR_INVALID_ARG_TYPE: "The parameter ordered a string and received a surprise guest.",
|
|
621
|
+
ERR_INVALID_ARG_VALUE: "The type is correct. Its life choices are not.",
|
|
622
|
+
ERR_OUT_OF_RANGE: "The number wandered beyond the approved fence.",
|
|
623
|
+
ERR_HTTP_HEADERS_SENT: "The response left the station. You cannot redecorate its headers now.",
|
|
624
|
+
ERR_HTTP_INVALID_STATUS_CODE: "That number is not a useful mood for an HTTP response.",
|
|
625
|
+
ERR_INVALID_URL: "The address has syntax ambitions but no navigable destination.",
|
|
626
|
+
ERR_PACKAGE_PATH_NOT_EXPORTED: "You are trying the package staff entrance.",
|
|
627
|
+
ERR_PACKAGE_IMPORT_NOT_DEFINED: "The alias has not been introduced to this package.",
|
|
628
|
+
ERR_INVALID_PACKAGE_CONFIG: "The package instructions have become abstract art.",
|
|
629
|
+
ERR_UNKNOWN_FILE_EXTENSION: "The loader does not speak this file dialect.",
|
|
630
|
+
ERR_IMPORT_ATTRIBUTE_MISSING: "The import arrived without its required name badge.",
|
|
631
|
+
ERR_STREAM_WRITE_AFTER_END: "The stream said goodbye. Your callback is still talking.",
|
|
632
|
+
ERR_STREAM_DESTROYED: "The stream has retired. Please respect its notice.",
|
|
633
|
+
ERR_SOCKET_BAD_PORT: "The port number did not pass the harbor inspection.",
|
|
634
|
+
SyntaxError: "The parser has found punctuation with questionable intentions.",
|
|
635
|
+
ReferenceError: "That name is not available for comment in this scope.",
|
|
636
|
+
RangeError: "The value or call stack has climbed over the fence.",
|
|
117
637
|
ECONNREFUSED: "Your app knocked. The service has apparently gone for coffee.",
|
|
118
638
|
ENOENT: "The file is playing hide-and-seek. It is currently winning.",
|
|
119
639
|
EADDRINUSE: "Two servers reserved the same chair. Only one gets to sit.",
|
|
@@ -192,8 +712,12 @@ ${result.likelyCauses.map((item) => `- ${item}`).join("\n")}`
|
|
|
192
712
|
${result.suggestions.map((item) => `- ${item}`).join("\n")}`] : []
|
|
193
713
|
].join("\n\n");
|
|
194
714
|
}
|
|
715
|
+
function errorCatalog(options = {}) {
|
|
716
|
+
return listErrors().map((code) => translateError({ code }, options));
|
|
717
|
+
}
|
|
195
718
|
// Annotate the CommonJS export names for ESM import in node:
|
|
196
719
|
0 && (module.exports = {
|
|
720
|
+
errorCatalog,
|
|
197
721
|
listErrors,
|
|
198
722
|
renderTranslation,
|
|
199
723
|
translateError,
|
package/index.d.cts
CHANGED
package/index.d.ts
CHANGED
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
renderTranslation,
|
|
7
7
|
translateErrors,
|
|
8
8
|
listErrors,
|
|
9
|
+
errorCatalog,
|
|
9
10
|
} from "./index.js";
|
|
10
11
|
|
|
11
12
|
import { readStdin } from "./input.js";
|
|
@@ -19,12 +20,13 @@ try {
|
|
|
19
20
|
json: { type: "boolean" },
|
|
20
21
|
batch: { type: "boolean" },
|
|
21
22
|
list: { type: "boolean" },
|
|
23
|
+
catalog: { type: "boolean" },
|
|
22
24
|
mode: { type: "string", default: "plain" },
|
|
23
25
|
},
|
|
24
26
|
});
|
|
25
27
|
if (values.help) {
|
|
26
28
|
console.log(
|
|
27
|
-
'Usage: error-translator <error code or quoted message> [--json] [--mode plain|rubber-duck]\n\nTranslate errors into human-readable guidance. Without arguments, read stdin (256 KiB). --batch reads a JSON array of 1–100 errors. --list lists supported codes.\n\nOptions:\n -h, --help Show help\n -v, --version Show version\n --json Print a structured JSON result\n --mode plain|rubber-duck Keep useful guidance; add duck commentary\n\nExamples:\n error-translator ECONNREFUSED\n error-translator "TypeError: value is not a function" --json\n\nExit codes: 0 translation/help/version; 2 invalid arguments.',
|
|
29
|
+
'Usage: error-translator <error code or quoted message> [--json] [--mode plain|rubber-duck]\n\nTranslate errors into human-readable guidance. Without arguments, read stdin (256 KiB). --batch reads a JSON array of 1–100 errors. --list lists supported codes. --catalog prints all explanations and checks.\n\nOptions:\n -h, --help Show help\n -v, --version Show version\n --json Print a structured JSON result\n --mode plain|rubber-duck Keep useful guidance; add duck commentary\n\nExamples:\n error-translator ECONNREFUSED\n error-translator "TypeError: value is not a function" --json\n\nExit codes: 0 translation/help/version; 2 invalid arguments.',
|
|
28
30
|
);
|
|
29
31
|
} else if (values.version) {
|
|
30
32
|
console.log(
|
|
@@ -32,6 +34,19 @@ try {
|
|
|
32
34
|
readFileSync(new URL("../package.json", import.meta.url), "utf8"),
|
|
33
35
|
).version,
|
|
34
36
|
);
|
|
37
|
+
} else if (values.catalog) {
|
|
38
|
+
if (positionals.length || values.batch || values.list)
|
|
39
|
+
throw new TypeError(
|
|
40
|
+
"--catalog does not accept input, --batch or --list.",
|
|
41
|
+
);
|
|
42
|
+
const catalog = errorCatalog({ mode: values.mode });
|
|
43
|
+
console.log(
|
|
44
|
+
values.json
|
|
45
|
+
? JSON.stringify(catalog, null, 2)
|
|
46
|
+
: catalog
|
|
47
|
+
.map((item) => item.code + " — " + renderTranslation(item))
|
|
48
|
+
.join("\n\n---\n\n"),
|
|
49
|
+
);
|
|
35
50
|
} else if (values.list) {
|
|
36
51
|
if (positionals.length || values.batch)
|
|
37
52
|
throw new TypeError("--list does not accept input or --batch.");
|
package/src/definitions.js
CHANGED
|
@@ -0,0 +1,494 @@
|
|
|
1
|
+
// Original explanations and practical checks; no automatic remediation.
|
|
2
|
+
export const extraDefinitions = {
|
|
3
|
+
EACCES: {
|
|
4
|
+
title: "Permission denied",
|
|
5
|
+
explanation: "The process lacks permission for the requested operation.",
|
|
6
|
+
likelyCauses: [
|
|
7
|
+
"A directory or file belongs to another account",
|
|
8
|
+
"The application runs under a restricted service identity",
|
|
9
|
+
],
|
|
10
|
+
suggestions: [
|
|
11
|
+
"Check the service identity and permissions on each parent directory.",
|
|
12
|
+
"Grant only the access the application needs; avoid running everything as administrator.",
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
EPERM: {
|
|
16
|
+
title: "Operation not permitted",
|
|
17
|
+
explanation:
|
|
18
|
+
"The operating system rejected an operation even though the target may exist.",
|
|
19
|
+
likelyCauses: [
|
|
20
|
+
"A protected resource or locked file",
|
|
21
|
+
"An operation forbidden by the current platform or identity",
|
|
22
|
+
],
|
|
23
|
+
suggestions: [
|
|
24
|
+
"Inspect the operation, ownership and platform restrictions.",
|
|
25
|
+
"Close the process holding the resource and retry only if the operation is intended.",
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
EEXIST: {
|
|
29
|
+
title: "Target already exists",
|
|
30
|
+
explanation:
|
|
31
|
+
"A creation operation requires a new target, but that target already exists.",
|
|
32
|
+
likelyCauses: ["A repeated initialization step", "A filename collision"],
|
|
33
|
+
suggestions: [
|
|
34
|
+
"Check the target before creating it and make initialization idempotent.",
|
|
35
|
+
"Use a distinct name rather than deleting an existing target blindly.",
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
ENOTDIR: {
|
|
39
|
+
title: "Expected a directory",
|
|
40
|
+
explanation:
|
|
41
|
+
"A path component used as a directory is actually another kind of file.",
|
|
42
|
+
likelyCauses: [
|
|
43
|
+
"A file appears in the middle of the path",
|
|
44
|
+
"A configuration value points to the wrong target",
|
|
45
|
+
],
|
|
46
|
+
suggestions: [
|
|
47
|
+
"Inspect each path component and its type.",
|
|
48
|
+
"Correct the directory configuration before retrying.",
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
EISDIR: {
|
|
52
|
+
title: "Expected a file",
|
|
53
|
+
explanation: "The operation received a directory where it expected a file.",
|
|
54
|
+
likelyCauses: [
|
|
55
|
+
"The filename is missing from a configured path",
|
|
56
|
+
"A directory was passed to a file operation",
|
|
57
|
+
],
|
|
58
|
+
suggestions: [
|
|
59
|
+
"Check the complete path and inspect the target type.",
|
|
60
|
+
"Use the appropriate directory API when working with directories.",
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
ENOTEMPTY: {
|
|
64
|
+
title: "Directory is not empty",
|
|
65
|
+
explanation:
|
|
66
|
+
"A directory operation requires an empty target, but entries remain.",
|
|
67
|
+
likelyCauses: [
|
|
68
|
+
"Generated files remain in the directory",
|
|
69
|
+
"Another process is still writing files",
|
|
70
|
+
],
|
|
71
|
+
suggestions: [
|
|
72
|
+
"List the remaining entries and identify their owner.",
|
|
73
|
+
"Remove only confirmed disposable content or choose a new directory.",
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
EMFILE: {
|
|
77
|
+
title: "Too many open files",
|
|
78
|
+
explanation: "The process has exhausted its available file descriptors.",
|
|
79
|
+
likelyCauses: [
|
|
80
|
+
"Handles are not closed",
|
|
81
|
+
"Too many files or sockets are opened concurrently",
|
|
82
|
+
],
|
|
83
|
+
suggestions: [
|
|
84
|
+
"Close handles in cleanup paths and bound concurrent work.",
|
|
85
|
+
"Inspect descriptor usage before considering a higher process limit.",
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
ENFILE: {
|
|
89
|
+
title: "System file table exhausted",
|
|
90
|
+
explanation: "The system cannot allocate another file handle.",
|
|
91
|
+
likelyCauses: [
|
|
92
|
+
"Many processes hold open files",
|
|
93
|
+
"The host has reached a system resource limit",
|
|
94
|
+
],
|
|
95
|
+
suggestions: [
|
|
96
|
+
"Inspect host-wide handle usage and identify runaway processes.",
|
|
97
|
+
"Reduce concurrency and resolve leaks before changing system limits.",
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
ENOSPC: {
|
|
101
|
+
title: "No space left",
|
|
102
|
+
explanation:
|
|
103
|
+
"The filesystem cannot allocate the space or resources required by the operation.",
|
|
104
|
+
likelyCauses: [
|
|
105
|
+
"The volume is full",
|
|
106
|
+
"Filesystem quotas or resource limits are exhausted",
|
|
107
|
+
],
|
|
108
|
+
suggestions: [
|
|
109
|
+
"Check free space, quotas and the volume receiving the write.",
|
|
110
|
+
"Clear verified disposable data and investigate rapid growth.",
|
|
111
|
+
],
|
|
112
|
+
},
|
|
113
|
+
EROFS: {
|
|
114
|
+
title: "Read-only filesystem",
|
|
115
|
+
explanation: "The target filesystem does not permit writes.",
|
|
116
|
+
likelyCauses: [
|
|
117
|
+
"A read-only container mount",
|
|
118
|
+
"A protected or recovery-mounted volume",
|
|
119
|
+
],
|
|
120
|
+
suggestions: [
|
|
121
|
+
"Inspect mount settings and choose an intended writable data location.",
|
|
122
|
+
"Change mount configuration only when the write is part of the deployment design.",
|
|
123
|
+
],
|
|
124
|
+
},
|
|
125
|
+
EBUSY: {
|
|
126
|
+
title: "Resource busy",
|
|
127
|
+
explanation:
|
|
128
|
+
"A resource cannot complete the requested operation while another operation holds it.",
|
|
129
|
+
likelyCauses: [
|
|
130
|
+
"A mounted or open resource",
|
|
131
|
+
"A concurrent operation has not finished",
|
|
132
|
+
],
|
|
133
|
+
suggestions: [
|
|
134
|
+
"Identify the process or operation holding the resource.",
|
|
135
|
+
"Wait for its completion or coordinate ownership instead of looping without a limit.",
|
|
136
|
+
],
|
|
137
|
+
},
|
|
138
|
+
EXDEV: {
|
|
139
|
+
title: "Cross-device operation",
|
|
140
|
+
explanation:
|
|
141
|
+
"An operation such as a rename crosses filesystem boundaries that it cannot cross directly.",
|
|
142
|
+
likelyCauses: [
|
|
143
|
+
"Temporary and destination files live on different volumes",
|
|
144
|
+
"A container mount creates a filesystem boundary",
|
|
145
|
+
],
|
|
146
|
+
suggestions: [
|
|
147
|
+
"Create temporary files on the destination filesystem when atomic rename is required.",
|
|
148
|
+
"Use an intentional copy-and-cleanup workflow when atomic movement is unnecessary.",
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
EPIPE: {
|
|
152
|
+
title: "Broken pipe",
|
|
153
|
+
explanation:
|
|
154
|
+
"The application wrote to a stream whose receiving end has closed.",
|
|
155
|
+
likelyCauses: [
|
|
156
|
+
"A downstream command exited",
|
|
157
|
+
"A peer disconnected before the write completed",
|
|
158
|
+
],
|
|
159
|
+
suggestions: [
|
|
160
|
+
"Handle stream errors and stop producing data when the consumer closes.",
|
|
161
|
+
"Distinguish an expected pipeline close from an unexpected connection failure.",
|
|
162
|
+
],
|
|
163
|
+
},
|
|
164
|
+
ECONNRESET: {
|
|
165
|
+
title: "Connection reset",
|
|
166
|
+
explanation:
|
|
167
|
+
"A connection was forcibly closed while the application was using it.",
|
|
168
|
+
likelyCauses: [
|
|
169
|
+
"The remote peer closed the connection",
|
|
170
|
+
"An intermediary interrupted the session",
|
|
171
|
+
],
|
|
172
|
+
suggestions: [
|
|
173
|
+
"Inspect peer logs, timeout settings and recent connection changes.",
|
|
174
|
+
"Retry only safe operations with a bounded backoff and avoid duplicate side effects.",
|
|
175
|
+
],
|
|
176
|
+
},
|
|
177
|
+
ETIMEDOUT: {
|
|
178
|
+
title: "Operation timed out",
|
|
179
|
+
explanation:
|
|
180
|
+
"A connection or operation did not finish within its allowed time.",
|
|
181
|
+
likelyCauses: [
|
|
182
|
+
"An unreachable or slow peer",
|
|
183
|
+
"A timeout shorter than the expected operation",
|
|
184
|
+
],
|
|
185
|
+
suggestions: [
|
|
186
|
+
"Check network reachability, service latency and the configured timeout.",
|
|
187
|
+
"Use bounded retries only for operations that are safe to repeat.",
|
|
188
|
+
],
|
|
189
|
+
},
|
|
190
|
+
ENOTFOUND: {
|
|
191
|
+
title: "Name lookup failed",
|
|
192
|
+
explanation:
|
|
193
|
+
"The requested hostname could not be resolved by the lookup operation.",
|
|
194
|
+
likelyCauses: [
|
|
195
|
+
"A misspelled hostname",
|
|
196
|
+
"Resolver configuration or lookup resources failed",
|
|
197
|
+
],
|
|
198
|
+
suggestions: [
|
|
199
|
+
"Check the exact hostname and DNS behavior from the same runtime environment.",
|
|
200
|
+
"Do not assume every lookup failure proves the hostname does not exist.",
|
|
201
|
+
],
|
|
202
|
+
},
|
|
203
|
+
EAI_AGAIN: {
|
|
204
|
+
title: "Temporary name lookup failure",
|
|
205
|
+
explanation: "Name resolution reported a temporary failure.",
|
|
206
|
+
likelyCauses: [
|
|
207
|
+
"A resolver is temporarily unavailable",
|
|
208
|
+
"A transient network or DNS problem",
|
|
209
|
+
],
|
|
210
|
+
suggestions: [
|
|
211
|
+
"Check the resolver and network from the affected host.",
|
|
212
|
+
"Apply bounded retry with backoff and report persistent failures.",
|
|
213
|
+
],
|
|
214
|
+
},
|
|
215
|
+
EADDRNOTAVAIL: {
|
|
216
|
+
title: "Local address unavailable",
|
|
217
|
+
explanation:
|
|
218
|
+
"The application tried to use an address that is not available on the local system.",
|
|
219
|
+
likelyCauses: [
|
|
220
|
+
"Binding to an address on another host",
|
|
221
|
+
"An interface address changed",
|
|
222
|
+
],
|
|
223
|
+
suggestions: [
|
|
224
|
+
"Inspect local interfaces and the configured bind address.",
|
|
225
|
+
"Use the intended local interface rather than a remote destination address.",
|
|
226
|
+
],
|
|
227
|
+
},
|
|
228
|
+
ECONNABORTED: {
|
|
229
|
+
title: "Connection aborted",
|
|
230
|
+
explanation: "A connection was aborted before the operation completed.",
|
|
231
|
+
likelyCauses: [
|
|
232
|
+
"A connection failure during setup or transfer",
|
|
233
|
+
"A local or intermediary cancellation",
|
|
234
|
+
],
|
|
235
|
+
suggestions: [
|
|
236
|
+
"Inspect the failure timing and both ends of the connection.",
|
|
237
|
+
"Handle cancellation separately from application errors when appropriate.",
|
|
238
|
+
],
|
|
239
|
+
},
|
|
240
|
+
ENETUNREACH: {
|
|
241
|
+
title: "Network unreachable",
|
|
242
|
+
explanation: "The host has no usable route to the requested network.",
|
|
243
|
+
likelyCauses: [
|
|
244
|
+
"Missing route or disconnected interface",
|
|
245
|
+
"Network isolation in a container or host",
|
|
246
|
+
],
|
|
247
|
+
suggestions: [
|
|
248
|
+
"Inspect connectivity and routing in the application environment.",
|
|
249
|
+
"Confirm the destination network is intended to be reachable.",
|
|
250
|
+
],
|
|
251
|
+
},
|
|
252
|
+
EHOSTUNREACH: {
|
|
253
|
+
title: "Host unreachable",
|
|
254
|
+
explanation:
|
|
255
|
+
"The destination host could not be reached through the available network path.",
|
|
256
|
+
likelyCauses: [
|
|
257
|
+
"The destination is unavailable",
|
|
258
|
+
"Routing or filtering blocks the path",
|
|
259
|
+
],
|
|
260
|
+
suggestions: [
|
|
261
|
+
"Check the destination address and routing from the affected host.",
|
|
262
|
+
"Inspect network policy rather than disabling protection blindly.",
|
|
263
|
+
],
|
|
264
|
+
},
|
|
265
|
+
EINVAL: {
|
|
266
|
+
title: "Invalid argument",
|
|
267
|
+
explanation: "The operating system rejected an argument to the operation.",
|
|
268
|
+
likelyCauses: [
|
|
269
|
+
"A value outside the operation contract",
|
|
270
|
+
"A platform-specific unsupported value",
|
|
271
|
+
],
|
|
272
|
+
suggestions: [
|
|
273
|
+
"Inspect the syscall and the exact values passed to it.",
|
|
274
|
+
"Validate values against the API and platform requirements.",
|
|
275
|
+
],
|
|
276
|
+
},
|
|
277
|
+
ABORT_ERR: {
|
|
278
|
+
title: "Operation aborted",
|
|
279
|
+
explanation: "An operation was cancelled through an abort mechanism.",
|
|
280
|
+
likelyCauses: [
|
|
281
|
+
"An AbortSignal was triggered",
|
|
282
|
+
"A caller timeout cancelled the operation",
|
|
283
|
+
],
|
|
284
|
+
suggestions: [
|
|
285
|
+
"Inspect who owns the abort controller and when cancellation occurred.",
|
|
286
|
+
"Treat expected cancellation separately and clean up resources.",
|
|
287
|
+
],
|
|
288
|
+
},
|
|
289
|
+
ERR_INVALID_ARG_TYPE: {
|
|
290
|
+
title: "Wrong argument type",
|
|
291
|
+
explanation: "A Node API received an argument of the wrong type.",
|
|
292
|
+
likelyCauses: [
|
|
293
|
+
"A missing or incorrect value",
|
|
294
|
+
"An unexpected return type passed to another API",
|
|
295
|
+
],
|
|
296
|
+
suggestions: [
|
|
297
|
+
"Read the parameter name in the error and inspect its actual value.",
|
|
298
|
+
"Validate the argument at the boundary where it enters your application.",
|
|
299
|
+
],
|
|
300
|
+
},
|
|
301
|
+
ERR_INVALID_ARG_VALUE: {
|
|
302
|
+
title: "Invalid argument value",
|
|
303
|
+
explanation: "An argument has a value the API does not accept.",
|
|
304
|
+
likelyCauses: [
|
|
305
|
+
"A valid type with an unsupported value",
|
|
306
|
+
"An invalid option combination",
|
|
307
|
+
],
|
|
308
|
+
suggestions: [
|
|
309
|
+
"Inspect the named parameter and documented accepted values.",
|
|
310
|
+
"Validate options before calling the API.",
|
|
311
|
+
],
|
|
312
|
+
},
|
|
313
|
+
ERR_OUT_OF_RANGE: {
|
|
314
|
+
title: "Value outside allowed range",
|
|
315
|
+
explanation: "A numeric or size argument falls outside the API range.",
|
|
316
|
+
likelyCauses: [
|
|
317
|
+
"An invalid offset or length",
|
|
318
|
+
"A computed limit exceeds the supported bounds",
|
|
319
|
+
],
|
|
320
|
+
suggestions: [
|
|
321
|
+
"Check the reported minimum and maximum and the calculation producing the value.",
|
|
322
|
+
"Add boundary tests for zero, limits and oversized input.",
|
|
323
|
+
],
|
|
324
|
+
},
|
|
325
|
+
ERR_HTTP_HEADERS_SENT: {
|
|
326
|
+
title: "Headers already sent",
|
|
327
|
+
explanation:
|
|
328
|
+
"The server tried to change headers after the response headers had been sent.",
|
|
329
|
+
likelyCauses: [
|
|
330
|
+
"Two code paths respond to the same request",
|
|
331
|
+
"An asynchronous callback runs after the response is complete",
|
|
332
|
+
],
|
|
333
|
+
suggestions: [
|
|
334
|
+
"Trace every response path and return after sending the response.",
|
|
335
|
+
"Coordinate asynchronous work so only one path owns the final response.",
|
|
336
|
+
],
|
|
337
|
+
},
|
|
338
|
+
ERR_HTTP_INVALID_STATUS_CODE: {
|
|
339
|
+
title: "Invalid HTTP status",
|
|
340
|
+
explanation: "The response status code is outside the accepted API range.",
|
|
341
|
+
likelyCauses: [
|
|
342
|
+
"An undefined value becomes a status",
|
|
343
|
+
"A business code is mistaken for an HTTP status",
|
|
344
|
+
],
|
|
345
|
+
suggestions: [
|
|
346
|
+
"Check the status value before assigning or sending it.",
|
|
347
|
+
"Keep internal result codes separate from HTTP status codes.",
|
|
348
|
+
],
|
|
349
|
+
},
|
|
350
|
+
ERR_INVALID_URL: {
|
|
351
|
+
title: "Invalid URL",
|
|
352
|
+
explanation: "The URL parser cannot interpret the supplied URL.",
|
|
353
|
+
likelyCauses: [
|
|
354
|
+
"A malformed absolute URL",
|
|
355
|
+
"A relative URL without a valid base",
|
|
356
|
+
],
|
|
357
|
+
suggestions: [
|
|
358
|
+
"Inspect the original input and supply an explicit base for relative paths.",
|
|
359
|
+
"Validate user-controlled URL inputs before making requests.",
|
|
360
|
+
],
|
|
361
|
+
},
|
|
362
|
+
ERR_PACKAGE_PATH_NOT_EXPORTED: {
|
|
363
|
+
title: "Package path not exported",
|
|
364
|
+
explanation: "A package exports map does not expose the requested subpath.",
|
|
365
|
+
likelyCauses: [
|
|
366
|
+
"Importing an internal package file",
|
|
367
|
+
"A dependency changed its public entry points",
|
|
368
|
+
],
|
|
369
|
+
suggestions: [
|
|
370
|
+
"Inspect the package exports and use a documented public entry.",
|
|
371
|
+
"Upgrade or pin compatible dependencies instead of relying on private paths.",
|
|
372
|
+
],
|
|
373
|
+
},
|
|
374
|
+
ERR_PACKAGE_IMPORT_NOT_DEFINED: {
|
|
375
|
+
title: "Package import not defined",
|
|
376
|
+
explanation: "A package imports map has no matching internal specifier.",
|
|
377
|
+
likelyCauses: [
|
|
378
|
+
"A missing imports mapping",
|
|
379
|
+
"A specifier is used outside its intended package scope",
|
|
380
|
+
],
|
|
381
|
+
suggestions: [
|
|
382
|
+
"Check package.json imports and the exact specifier.",
|
|
383
|
+
"Keep internal import aliases inside the package that defines them.",
|
|
384
|
+
],
|
|
385
|
+
},
|
|
386
|
+
ERR_INVALID_PACKAGE_CONFIG: {
|
|
387
|
+
title: "Invalid package configuration",
|
|
388
|
+
explanation: "Node could not use the package configuration.",
|
|
389
|
+
likelyCauses: ["Malformed package.json", "An invalid configuration field"],
|
|
390
|
+
suggestions: [
|
|
391
|
+
"Read the named package.json and validate its JSON and relevant fields.",
|
|
392
|
+
"Check the first configuration error before reinstalling dependencies.",
|
|
393
|
+
],
|
|
394
|
+
},
|
|
395
|
+
ERR_UNKNOWN_FILE_EXTENSION: {
|
|
396
|
+
title: "Unknown module file extension",
|
|
397
|
+
explanation:
|
|
398
|
+
"The module loader does not recognize the file extension in this context.",
|
|
399
|
+
likelyCauses: [
|
|
400
|
+
"An unsupported file type is imported",
|
|
401
|
+
"The required build or loader is missing",
|
|
402
|
+
],
|
|
403
|
+
suggestions: [
|
|
404
|
+
"Check the imported extension and the runtime module configuration.",
|
|
405
|
+
"Compile to a supported format or use a documented loader setup.",
|
|
406
|
+
],
|
|
407
|
+
},
|
|
408
|
+
ERR_IMPORT_ATTRIBUTE_MISSING: {
|
|
409
|
+
title: "Required import attribute missing",
|
|
410
|
+
explanation: "A module import requires an attribute that was not provided.",
|
|
411
|
+
likelyCauses: [
|
|
412
|
+
"A JSON import lacks the required type attribute",
|
|
413
|
+
"An import was copied from a different runtime version",
|
|
414
|
+
],
|
|
415
|
+
suggestions: [
|
|
416
|
+
"Check the module type and import syntax for your supported Node version.",
|
|
417
|
+
"Use the required import attributes or an appropriate file-reading API.",
|
|
418
|
+
],
|
|
419
|
+
},
|
|
420
|
+
ERR_STREAM_WRITE_AFTER_END: {
|
|
421
|
+
title: "Write after stream end",
|
|
422
|
+
explanation: "Data was written after the writable stream had ended.",
|
|
423
|
+
likelyCauses: [
|
|
424
|
+
"A late callback writes to a closed stream",
|
|
425
|
+
"Multiple owners end and write the same stream",
|
|
426
|
+
],
|
|
427
|
+
suggestions: [
|
|
428
|
+
"Trace the stream lifecycle and coordinate the writer with completion.",
|
|
429
|
+
"Test delayed callbacks and ensure end is called once work is complete.",
|
|
430
|
+
],
|
|
431
|
+
},
|
|
432
|
+
ERR_STREAM_DESTROYED: {
|
|
433
|
+
title: "Stream destroyed",
|
|
434
|
+
explanation: "An operation used a stream after it had been destroyed.",
|
|
435
|
+
likelyCauses: [
|
|
436
|
+
"A prior error destroyed the stream",
|
|
437
|
+
"Cleanup ran while work was still pending",
|
|
438
|
+
],
|
|
439
|
+
suggestions: [
|
|
440
|
+
"Inspect the original stream error and cancellation timing.",
|
|
441
|
+
"Stop dependent work when the stream closes or is destroyed.",
|
|
442
|
+
],
|
|
443
|
+
},
|
|
444
|
+
ERR_SOCKET_BAD_PORT: {
|
|
445
|
+
title: "Invalid socket port",
|
|
446
|
+
explanation: "A socket port value is not accepted by the API.",
|
|
447
|
+
likelyCauses: [
|
|
448
|
+
"A malformed environment variable",
|
|
449
|
+
"A number outside the port range",
|
|
450
|
+
],
|
|
451
|
+
suggestions: [
|
|
452
|
+
"Validate and parse the port configuration before creating the connection.",
|
|
453
|
+
"Do not substitute a silent default for a visibly invalid production setting.",
|
|
454
|
+
],
|
|
455
|
+
},
|
|
456
|
+
SyntaxError: {
|
|
457
|
+
title: "Invalid JavaScript syntax",
|
|
458
|
+
explanation: "The parser cannot interpret the source or input syntax.",
|
|
459
|
+
likelyCauses: [
|
|
460
|
+
"Malformed JavaScript or JSON",
|
|
461
|
+
"Syntax unsupported by the current runtime",
|
|
462
|
+
],
|
|
463
|
+
suggestions: [
|
|
464
|
+
"Read the first reported location and inspect nearby delimiters and tokens.",
|
|
465
|
+
"Confirm the input format and runtime version before changing unrelated code.",
|
|
466
|
+
],
|
|
467
|
+
},
|
|
468
|
+
ReferenceError: {
|
|
469
|
+
title: "Name is not available",
|
|
470
|
+
explanation:
|
|
471
|
+
"An expression refers to a binding that is not available in its current scope or initialization state.",
|
|
472
|
+
likelyCauses: [
|
|
473
|
+
"A misspelled or out-of-scope variable",
|
|
474
|
+
"Access before initialization",
|
|
475
|
+
],
|
|
476
|
+
suggestions: [
|
|
477
|
+
"Inspect the referenced name and its scope at the reported line.",
|
|
478
|
+
"Check initialization order and add a focused regression test.",
|
|
479
|
+
],
|
|
480
|
+
},
|
|
481
|
+
RangeError: {
|
|
482
|
+
title: "Value exceeds a permitted range",
|
|
483
|
+
explanation:
|
|
484
|
+
"An operation received a value outside its allowed range or exhausted a range-related resource.",
|
|
485
|
+
likelyCauses: [
|
|
486
|
+
"An invalid numeric size or index",
|
|
487
|
+
"Excessive recursion or allocation",
|
|
488
|
+
],
|
|
489
|
+
suggestions: [
|
|
490
|
+
"Read the exact message to distinguish numeric bounds from stack exhaustion.",
|
|
491
|
+
"Inspect boundary values and recursion termination rather than treating every RangeError alike.",
|
|
492
|
+
],
|
|
493
|
+
},
|
|
494
|
+
};
|
package/src/index.js
CHANGED
|
@@ -8,6 +8,55 @@ export function translateErrors(errors, options = {}) {
|
|
|
8
8
|
return Array.from(errors, (error) => translateError(error, options));
|
|
9
9
|
}
|
|
10
10
|
const duckLines = {
|
|
11
|
+
EACCES: "The file has a guest list. Your process is not on it.",
|
|
12
|
+
EPERM: "The operating system has declined your ambitious proposal.",
|
|
13
|
+
EEXIST: "The target is already here and has not agreed to be replaced.",
|
|
14
|
+
ENOTDIR: "That hallway is actually a cupboard.",
|
|
15
|
+
EISDIR: "You asked for one file and received the whole neighborhood.",
|
|
16
|
+
ENOTEMPTY: "The directory still has roommates.",
|
|
17
|
+
EMFILE: "Your process opened every door and forgot to close them.",
|
|
18
|
+
ENFILE: "The host has run out of chairs for file handles.",
|
|
19
|
+
ENOSPC: "The disk has eaten the final snack.",
|
|
20
|
+
EROFS: "This filesystem is a museum: look, but do not rearrange.",
|
|
21
|
+
EBUSY: "The resource is in another meeting.",
|
|
22
|
+
EXDEV: "The rename has reached the border and needs a different passport.",
|
|
23
|
+
EPIPE: "The audience left before your stream finished the speech.",
|
|
24
|
+
ECONNRESET: "The other end hung up without the usual pleasantries.",
|
|
25
|
+
ETIMEDOUT: "The operation is late and has not brought a believable excuse.",
|
|
26
|
+
ENOTFOUND: "The hostname is not answering roll call.",
|
|
27
|
+
EAI_AGAIN: "DNS requests a brief intermission, not eternal optimism.",
|
|
28
|
+
EADDRNOTAVAIL: "That address does not live on this machine.",
|
|
29
|
+
ECONNABORTED: "The connection left before the conversation was finished.",
|
|
30
|
+
ENETUNREACH: "The packet has no road to the destination.",
|
|
31
|
+
EHOSTUNREACH:
|
|
32
|
+
"The route exists; the destination is still playing hard to reach.",
|
|
33
|
+
EINVAL: "The argument has failed the entrance interview.",
|
|
34
|
+
ABORT_ERR: "The caller pulled the emergency stop. Ask why before restarting.",
|
|
35
|
+
ERR_INVALID_ARG_TYPE:
|
|
36
|
+
"The parameter ordered a string and received a surprise guest.",
|
|
37
|
+
ERR_INVALID_ARG_VALUE: "The type is correct. Its life choices are not.",
|
|
38
|
+
ERR_OUT_OF_RANGE: "The number wandered beyond the approved fence.",
|
|
39
|
+
ERR_HTTP_HEADERS_SENT:
|
|
40
|
+
"The response left the station. You cannot redecorate its headers now.",
|
|
41
|
+
ERR_HTTP_INVALID_STATUS_CODE:
|
|
42
|
+
"That number is not a useful mood for an HTTP response.",
|
|
43
|
+
ERR_INVALID_URL:
|
|
44
|
+
"The address has syntax ambitions but no navigable destination.",
|
|
45
|
+
ERR_PACKAGE_PATH_NOT_EXPORTED: "You are trying the package staff entrance.",
|
|
46
|
+
ERR_PACKAGE_IMPORT_NOT_DEFINED:
|
|
47
|
+
"The alias has not been introduced to this package.",
|
|
48
|
+
ERR_INVALID_PACKAGE_CONFIG:
|
|
49
|
+
"The package instructions have become abstract art.",
|
|
50
|
+
ERR_UNKNOWN_FILE_EXTENSION: "The loader does not speak this file dialect.",
|
|
51
|
+
ERR_IMPORT_ATTRIBUTE_MISSING:
|
|
52
|
+
"The import arrived without its required name badge.",
|
|
53
|
+
ERR_STREAM_WRITE_AFTER_END:
|
|
54
|
+
"The stream said goodbye. Your callback is still talking.",
|
|
55
|
+
ERR_STREAM_DESTROYED: "The stream has retired. Please respect its notice.",
|
|
56
|
+
ERR_SOCKET_BAD_PORT: "The port number did not pass the harbor inspection.",
|
|
57
|
+
SyntaxError: "The parser has found punctuation with questionable intentions.",
|
|
58
|
+
ReferenceError: "That name is not available for comment in this scope.",
|
|
59
|
+
RangeError: "The value or call stack has climbed over the fence.",
|
|
11
60
|
ECONNREFUSED: "Your app knocked. The service has apparently gone for coffee.",
|
|
12
61
|
ENOENT: "The file is playing hide-and-seek. It is currently winning.",
|
|
13
62
|
EADDRINUSE: "Two servers reserved the same chair. Only one gets to sit.",
|
|
@@ -114,3 +163,8 @@ export function renderTranslation(result) {
|
|
|
114
163
|
: []),
|
|
115
164
|
].join("\n\n");
|
|
116
165
|
}
|
|
166
|
+
|
|
167
|
+
/** Read the built-in guidance as independent structured records. */
|
|
168
|
+
export function errorCatalog(options = {}) {
|
|
169
|
+
return listErrors().map((code) => translateError({ code }, options));
|
|
170
|
+
}
|