Skip to content

Commit

Permalink
fix: unauthorized access error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
favoyang committed Aug 2, 2020
1 parent 9710d4c commit 51fcf9d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/cmd-login.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ const npmLogin = async function({ username, password, email, registry }) {
const token = data.token;
return { code: 0, token };
} catch (err) {
console.log(err);
if (err.code == "EAUTHUNKNOWN") {
if (err.statusCode == 401 || err.code == "EAUTHUNKNOWN") {
log.warn("Incorrect username or password");
return { code: 1 };
} else {
Expand Down

0 comments on commit 51fcf9d

Please sign in to comment.