mirror of
https://github.com/tenrok/axios.git
synced 2026-06-11 18:02:32 +03:00
fix(core/axios): handle un-writable error stack (#6362)
Co-authored-by: Dmitriy Mozgovoy <robotshara@gmail.com>
This commit is contained in:
committed by
GitHub
parent
d1d359da34
commit
81e0455b7b
+9
-6
@@ -46,12 +46,15 @@ class Axios {
|
||||
|
||||
// slice off the Error: ... line
|
||||
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
|
||||
|
||||
if (!err.stack) {
|
||||
err.stack = stack;
|
||||
// match without the 2 top stack lines
|
||||
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
|
||||
err.stack += '\n' + stack
|
||||
try {
|
||||
if (!err.stack) {
|
||||
err.stack = stack;
|
||||
// match without the 2 top stack lines
|
||||
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
|
||||
err.stack += '\n' + stack
|
||||
}
|
||||
} catch (e) {
|
||||
// ignore the case where "stack" is an un-writable property
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user