-
Notifications
You must be signed in to change notification settings - Fork 654
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
Add registry validator test; make 404 responses compatible with npm API #57
Add registry validator test; make 404 responses compatible with npm API #57
Conversation
Include Mocha tests from the validation suite in `npm test`.
The previous commit dabf5e1 made the 404 response for unknown package *name* correct, but broke the expected format of the 404 response for unknown package *version*. This commit fixes the problem by sending 'not_found' response only when the package was not found at all. The following commits are partially reverted: df49fb8 dabf5e1
How about reverting that entire patch? Sinopia returns a nice error message that depend on an exact error that occured. In the future it might contain information about whether npm registry is reachable or not, or useful other info. Instead of that npm is returning its own error message losing this information. Also, we're using sinopia behind nginx redirecting
|
What I don't like about this approach is the stack trace printed by npm, which makes the error look scarier than it is. Users should not get stack traces in common situations like when they a mistype package name. I suppose the right way how to address custom error messages is to put them in
That's annoying :( However, it's a bug of the npm client and should be fixed there. I'll try to look into this problem next week and submit a pull request with a fix to the npm project.
I hope my explanation above convinced you that reverting the entire patch is not the best solution. |
If you mistype version or tag, npm will output stack trace. In fact, npm is outputting stack trace almost on any error. Why this one should be any different?
npm ignores "reason" and doesn't write it to the user. If error message have some vital information, it's better to display it to the user even though it's accompanied by a stack trace. |
I'll just ask this. Which error message is more useful?
|
I wanted to write that you are not right, but alas, it's really printing stack traces :( In that case you are probably right, let's revert #56 and close this one. I'll try to figure out how to fix my test suite to make the error message check less strict. |
BTW, when the package is not found because the public registry is down, you should probably return 504 Gateway Timeout instead of 404.
|
rename process to verdaccio
The previous pull request #56 made the 404 response for unknown
package name correct, but broke the expected format of the 404 response
for unknown package version.
This pull request fixes the problem.
The first commit adds a test suite executing npm commands agains the Sinopia registry.
The second commit implements the necessary changes in Sinopia.