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.
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.
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-meantake a package so it can be sync and called more easily from the error handlers