mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-11 18:32:20 +08:00
fix(api-error) Fix APIError constructor
This commit is contained in:
parent
31dc6d67cf
commit
8b91fa9780
1 changed files with 5 additions and 1 deletions
|
@ -28,7 +28,11 @@ export class APIError extends Error {
|
|||
|
||||
this.stack = (new Error()).stack;
|
||||
if (!this.message) {
|
||||
this.message = (this.body ? this.body.message : null) || this.body || (this.error ? this.error.toString() : null);
|
||||
if (this.body) {
|
||||
this.message = this.body.message || this.body.error || JSON.stringify(this.body)
|
||||
} else {
|
||||
this.message = this.error ? this.error.message || this.error.toString() : null;
|
||||
}
|
||||
}
|
||||
this.errorType = (this.body ? this.body.type : null);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue