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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user