We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Error
1 parent 1bb8b8f commit 759acd7Copy full SHA for 759acd7
src/error/stack.js
@@ -1,8 +1,12 @@
1
// Retrieve `error.stack` by re-using the original error's stack trace
2
// Remove first line of `Error.stack` as it contains `Error.name|message`,
3
// which is already present in the upper error's `message`
4
-export const getStack = function({ stack = '' }) {
5
- return stack.replace(FIRST_LINE_REGEXP, '')
+export const getStack = function(mainValue) {
+ if (!(mainValue instanceof Error)) {
6
+ return ''
7
+ }
8
+
9
+ return mainValue.stack.replace(FIRST_LINE_REGEXP, '')
10
}
11
12
const FIRST_LINE_REGEXP = /.*\n/u
0 commit comments