Commit 54d31af
committed
feat(errors): add isError, isErrnoException, errorMessage, errorStack
- `isError(value)` — spec-compliant ES2025 `Error.isError` with an
`@@toStringTag`-based shim for older engines. Cross-realm-safe
(recognizes Errors from worker threads, vm contexts, iframes).
- `isErrorBuiltin` — reference to the native `Error.isError` when
available, `undefined` otherwise. Exposed so callers/tests can
detect the fast-path.
- `isErrorShim` — the fallback. Exported so test suites on engines
that ship native can still exercise the shim branch directly.
- `isErrnoException(value)` — narrows to `NodeJS.ErrnoException` (an
Error with a non-empty uppercase-prefixed `.code` matching libuv's
`UV_E*` / Node's `ERR_*` conventions). Cross-realm safe.
- `errorMessage(value)` — readable message from any caught value with
cause-chain walking via `messageWithCauses`. Falls back to the
shared `UNKNOWN_ERROR` sentinel for nullish / empty / opaque values.
- `errorStack(value)` — cause-aware stack for Errors, `undefined`
otherwise. Safe for `logger.error(msg, { stack: errorStack(e) })`.
- Re-export `UNKNOWN_ERROR` from `constants/core` so callers don't
need a separate import.
Patch pony-cause@2.1.11 to use `isError` internally in
`messageWithCauses` / `stackWithCauses` / `findCauseByReference` /
`getErrorCause`. Cross-realm Errors previously returned `''` from
those helpers because of same-realm `instanceof Error` gates.
Sweep socket-lib src/ to use the new helpers where appropriate
(performance.ts, github.ts, process-lock.ts, releases/github.ts,
dlx/manifest.ts, dlx/package.ts, json/edit.ts, packages/isolation.ts).1 parent 74a2940 commit 54d31af
13 files changed
Lines changed: 670 additions & 67 deletions
File tree
- patches
- src
- dlx
- json
- packages
- releases
- test/unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | 1 | | |
7 | 2 | | |
8 | 3 | | |
| |||
12 | 7 | | |
13 | 8 | | |
14 | 9 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
20 | 17 | | |
21 | 18 | | |
22 | 19 | | |
| |||
38 | 35 | | |
39 | 36 | | |
40 | 37 | | |
41 | | - | |
42 | 38 | | |
| 39 | + | |
43 | 40 | | |
44 | 41 | | |
45 | 42 | | |
| |||
53 | 50 | | |
54 | 51 | | |
55 | 52 | | |
56 | | - | |
57 | 53 | | |
| 54 | + | |
58 | 55 | | |
59 | 56 | | |
60 | 57 | | |
| |||
75 | 72 | | |
76 | 73 | | |
77 | 74 | | |
78 | | - | |
79 | 75 | | |
| 76 | + | |
| 77 | + | |
80 | 78 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| |||
205 | 206 | | |
206 | 207 | | |
207 | 208 | | |
208 | | - | |
209 | | - | |
210 | | - | |
| 209 | + | |
211 | 210 | | |
212 | 211 | | |
213 | 212 | | |
| |||
227 | 226 | | |
228 | 227 | | |
229 | 228 | | |
230 | | - | |
231 | | - | |
232 | | - | |
| 229 | + | |
233 | 230 | | |
234 | 231 | | |
235 | 232 | | |
| |||
275 | 272 | | |
276 | 273 | | |
277 | 274 | | |
278 | | - | |
279 | | - | |
280 | | - | |
| 275 | + | |
281 | 276 | | |
282 | 277 | | |
283 | 278 | | |
| |||
292 | 287 | | |
293 | 288 | | |
294 | 289 | | |
295 | | - | |
296 | | - | |
297 | | - | |
| 290 | + | |
298 | 291 | | |
299 | 292 | | |
300 | 293 | | |
| |||
337 | 330 | | |
338 | 331 | | |
339 | 332 | | |
340 | | - | |
341 | | - | |
342 | | - | |
| 333 | + | |
343 | 334 | | |
344 | 335 | | |
345 | 336 | | |
| |||
390 | 381 | | |
391 | 382 | | |
392 | 383 | | |
393 | | - | |
394 | | - | |
395 | | - | |
| 384 | + | |
396 | 385 | | |
397 | 386 | | |
398 | 387 | | |
| |||
404 | 393 | | |
405 | 394 | | |
406 | 395 | | |
407 | | - | |
| 396 | + | |
408 | 397 | | |
409 | 398 | | |
410 | 399 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
553 | 554 | | |
554 | 555 | | |
555 | 556 | | |
556 | | - | |
557 | | - | |
558 | | - | |
559 | | - | |
| 557 | + | |
560 | 558 | | |
561 | 559 | | |
562 | 560 | | |
| |||
0 commit comments