Skip to content

Commit d60d684

Browse files
Fixed AxiosError stack capturing; (axios#4718)
Co-authored-by: Jay <jasonsaayman@gmail.com>
1 parent 65b9295 commit d60d684

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/core/AxiosError.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ function AxiosError(message, code, config, request, response) {
1616
Error.call(this);
1717

1818
if (Error.captureStackTrace) {
19-
Error.captureStackTrace(this);
19+
Error.captureStackTrace(this, this.constructor);
20+
} else {
21+
this.stack = (new Error()).stack;
2022
}
2123

2224
this.message = message;

0 commit comments

Comments
 (0)