Skip to content

Commit

Permalink
fix(common-request.js): print some meaningful error message in case o…
Browse files Browse the repository at this point in the history
…f unsuccessful authentication (#99)
  • Loading branch information
tremes authored and lholmquist committed Dec 7, 2018
1 parent 7f2da1e commit 8d6ad07
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/common-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ function doRequestWithBasicAuth (client, options = {}) {
request(req, (err, resp) => {
if (err) return reject(buildError(err));

if (resp.statusCode === 401) {
return reject(new Error(`401 Unable to authenticate user ${clientConfig.user.username}`));
}
// extract access_token value from hash header
const hash = resp.request.uri.hash;
const startIndex = hash.indexOf('=') + 1;
Expand Down

0 comments on commit 8d6ad07

Please sign in to comment.