2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-14 18:42:33 +03:00

Updating AxiosError to include stack trace (#4624)

Related to discussions here https://github.com/axios/axios/issues/2387

Attempt to capture the stack trace at the time the error is created in
order to maintain context about where the error originates from.

Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
Des Preston
2022-05-03 12:46:10 -04:00
committed by GitHub
parent 8213da4f16
commit 7920d11144
2 changed files with 7 additions and 1 deletions
+5
View File
@@ -14,6 +14,11 @@ var utils = require('../utils');
*/
function AxiosError(message, code, config, request, response) {
Error.call(this);
if (Error.captureStackTrace) {
Error.captureStackTrace(this);
}
this.message = message;
this.name = 'AxiosError';
code && (this.code = code);