Skip to content

Commit

Permalink
fix: the type of clientside response status code
Browse files Browse the repository at this point in the history
the status code such as `401`, `403` should be a number, but not a
string. I might introduced this unexpectedly.
  • Loading branch information
Gyumeijie committed Sep 17, 2018
1 parent f326bc3 commit d934a9c
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,12 @@ const basicOptions = {
let repoInfo = {};

function processClientError(error, retryCallback) {
if (error.response.status === '401') {
console.log('\n');

if (error.response.status === 401) {
// Unauthorized
console.error('Bad credentials, please check your username or password(or access token)!');
} else if (error.response.status === '403') {
} else if (error.response.status === 403) {
if (authentication.auth) {
// If the default API access rate without authentication exceeds and the command line
// authentication is provided, then we switch to use authentication
Expand All @@ -216,8 +218,14 @@ function processClientError(error, retryCallback) {
+ ' Check out the documentation for more details. https://developer.github.com/v3/#rate-limiting');
}
} else {
console.error(error.message);
let errMsg = error.message;
if (error.response.status === 404) {
errMsg += ', please check the repo URL!';
}
console.error(errMsg);
}

progressBar.stop();
}

function extractFilenameAndDirectoryFrom(path) {
Expand Down

0 comments on commit d934a9c

Please sign in to comment.