Skip to content

Better error messages for 400, 401 and 404 #2152

@donaldpipowitch

Description

@donaldpipowitch

Do you want to request a bug?
bug

What is the current behavior?
If the current behavior is a bug, please provide the steps to reproduce.

400 and 401 errors are reported as 404. See #2151 for an example. It took me a while to figure out that #2151 was actually an auth bug with a 401 error status code, because it was reported as a "not found" error.

I think this bug occurs because of this line.

What is the expected behavior?

Report errors like this:

  • 400: error Couldn't install package "foo" on the "npm" registry, because there was an unknown problem.
  • 401: error Couldn't install package "foo" on the "npm" registry, because you're unauthorized.
  • 404: error Couldn't find package "foo" on the "npm" registry.

Please mention your node.js, yarn and operating system version.

$ node -v
v6.9.1

$ yarn -V
0.18.0

macOS 10.12.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions