From 8b91fa9780707eaf2aa4d8c9412f080689501011 Mon Sep 17 00:00:00 2001 From: Juan Tejada Date: Fri, 10 Feb 2017 09:28:04 -0800 Subject: [PATCH] fix(api-error) Fix APIError constructor --- src/flux/errors.es6 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/flux/errors.es6 b/src/flux/errors.es6 index f3f9d36e5..7eb41e41a 100644 --- a/src/flux/errors.es6 +++ b/src/flux/errors.es6 @@ -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); }