| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f5ff88b commit 09d29ca
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1215,7 +1215,7 @@ function getStackFrames(ctx, err, stack) { | |||
| 1215 | 1215 | const frames = stack.split('\n'); | |
| 1216 | 1216 | ||
| 1217 | 1217 | // Remove stack frames identical to frames in cause. | |
| 1218 | - if (err.cause) { | ||
| 1218 | + if (err.cause && isError(err.cause)) { | ||
| 1219 | 1219 | const causeStack = getStackString(err.cause); | |
| 1220 | 1220 | const causeStackStart = causeStack.indexOf('\n at'); | |
| 1221 | 1221 | if (causeStackStart !== -1) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,6 +13,19 @@ const cause2 = new FoobarError('Individual message', { cause: cause1 }); | |||
| 13 | 13 | cause2.extraProperties = 'Yes!'; | |
| 14 | 14 | const cause3 = new Error('Stack causes', { cause: cause2 }); | |
| 15 | 15 | ||
| 16 | + const cause4 = new Error('Number error cause', { cause: 42 }); | ||
| 17 | + const cause5 = new Error('Object cause', { | ||
| 18 | + cause: { | ||
| 19 | + message: 'Unique', | ||
| 20 | + name: 'Error', | ||
| 21 | + stack: 'Error: Unique\n' + | ||
| 22 | + ' at Module._compile (node:internal/modules/cjs/loader:827:30)' | ||
| 23 | + } | ||
| 24 | + }); | ||
| 25 | + | ||
| 26 | + console.log(cause4); | ||
| 27 | + console.log(cause5); | ||
| 28 | + | ||
| 16 | 29 | process.nextTick(() => { | |
| 17 | 30 | const error = new RangeError('New Stack Frames', { cause: cause2 }); | |
| 18 | 31 | const error2 = new RangeError('New Stack Frames', { cause: cause3 }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,28 @@ | |||
| 1 | + Error: Number error cause | ||
| 2 | + at * | ||
| 3 | + at * | ||
| 4 | + at * | ||
| 5 | + at * | ||
| 6 | + at * | ||
| 7 | + at * | ||
| 8 | + at * { | ||
| 9 | + [cause]: 42 | ||
| 10 | + } | ||
| 11 | + Error: Object cause | ||
| 12 | + at * | ||
| 13 | + at * | ||
| 14 | + at * | ||
| 15 | + at * | ||
| 16 | + at * | ||
| 17 | + at * | ||
| 18 | + at * { | ||
| 19 | + [cause]: { | ||
| 20 | + message: 'Unique', | ||
| 21 | + name: 'Error', | ||
| 22 | + stack: 'Error: Unique\n' + | ||
| 23 | + ' at Module._compile (node:internal/modules/cjs/loader:827:30)' | ||
| 24 | + } | ||
| 25 | + } | ||
| 1 | 26 | RangeError: New Stack Frames | |
| 2 | 27 | at * | |
| 3 | 28 | *[90m at *[39m { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments