fix(refactor): create new error output primitives#7515
Merged
lukekarrys merged 2 commits intolatestfrom May 13, 2024
Merged
Conversation
1bdb860 to
db68fd2
Compare
Collaborator
|
no statistically significant performance changes detected timing results
|
lukekarrys
commented
May 13, 2024
lukekarrys
commented
May 13, 2024
lukekarrys
commented
May 13, 2024
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
lukekarrys
commented
May 13, 2024
| ], | ||
| Array [ | ||
| "404", | ||
| "Note that you can also install from a", |
Contributor
Author
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.
lukekarrys
commented
May 13, 2024
| module.exports = { | ||
| outputError, | ||
| jsonError, | ||
| } |
Contributor
Author
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.
wraithgar
approved these changes
May 13, 2024
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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