From a28e4b35df1c40312d083c312d106515b61807e9 Mon Sep 17 00:00:00 2001 From: Michael Adams Date: Tue, 18 Oct 2016 09:35:33 +1300 Subject: [PATCH] Better error reporting --- lib/flick-api.js | 3 ++- src/flick-api.coffee | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/flick-api.js b/lib/flick-api.js index d8d508b..6485203 100644 --- a/lib/flick-api.js +++ b/lib/flick-api.js @@ -26,8 +26,9 @@ password: this.password }).end((function(_this) { return function(err, resp) { + var _ref; if (err) { - return _this.emit('error', "Error", err); + return _this.emit('error', ((_ref = err.response) != null ? _ref.text : void 0) || "Error", err); } else if (resp.body.id_token) { _this.token = resp.body.id_token; return _this.emit('authenticated'); diff --git a/src/flick-api.coffee b/src/flick-api.coffee index 428fc89..0b16139 100644 --- a/src/flick-api.coffee +++ b/src/flick-api.coffee @@ -18,7 +18,7 @@ class FlickAPI extends EventEmitter } .end (err, resp) => if err - @emit 'error', "Error", err + @emit 'error', err.response?.text || "Error", err else if resp.body.id_token @token = resp.body.id_token @emit 'authenticated'