fix(core): Return correct error message if Axios error (#3478)

This commit is contained in:
Ricardo Espinoza 2022-06-18 00:39:49 -04:00 committed by GitHub
parent 74e6b06467
commit 1bef4df75f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -290,6 +290,12 @@ export class NodeApiError extends NodeError {
// only for request library error
this.removeCircularRefs(error.error as JsonObject);
}
// if it's an error generated by axios
// look for descriptions in the response object
if (error.isAxiosError) {
error = error.response as JsonObject;
}
if (message) {
this.message = message;
this.description = description;