Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 404 error handling #22

Merged
merged 1 commit into from
Feb 27, 2024
Merged

Conversation

tommy-mitchell
Copy link
Contributor

With the switch to ky, the HTTP status code is now on error.response.status.

@sindresorhus sindresorhus merged commit f8e0a28 into sindresorhus:main Feb 27, 2024
3 checks passed
@tommy-mitchell
Copy link
Contributor Author

@sindresorhus noticed this could be break if error is not an HTTPError:

npm-user/index.js

Lines 28 to 32 in 38a7c48

if (error.response.status === 404) {
const notFoundError = new Error(`User \`${username}\` could not be found`, {cause: error});
notFoundError.code = 'ERR_NO_NPM_USER';
throw notFoundError;
}

Should probably be error?.response?.status.

@sindresorhus
Copy link
Owner

https://github.com/sindresorhus/npm-user/releases/tag/v6.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants