-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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(refactor): create new error output primitives #7515
Conversation
1bdb860
to
db68fd2
Compare
no statistically significant performance changes detected timing results
|
These will be used to generate error messages from both commands and the exit handler. Also makes the did-you-mean function take a package so it can be sync and called more easily from the error handlers.
350d3c1
to
9e3cae2
Compare
], | ||
Array [ | ||
"404", | ||
"Note that you can also install from a", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These snapshot changes don't actually change what is displayed to the user. The snapshots changed because these are unit tests.
When we format these messages consecutive calls to output with the same first param (404
in this case) are rendered identically to one call with a message that includes newlines.
module.exports = { | ||
outputError, | ||
jsonError, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a separate file because these functions will get used in multiple places by #7508.
They are also separate from error-message.js
because they need to be required eagerly to prevent the case of them being removed when npm updates itself.
These will be used to generate normal and json error messages in the same format from both commands and the exit handler.
This also does a few others things:
did-you-mean
take a package so it can be sync and called more easily from the error handlers