assert: accept undefined as message input#22696
Closed
BridgeAR wants to merge 2 commits intonodejs:masterfrom
Closed
assert: accept undefined as message input#22696BridgeAR wants to merge 2 commits intonodejs:masterfrom
BridgeAR wants to merge 2 commits intonodejs:masterfrom
Conversation
So far it was difficult to tell what the actual error was about if there was only the user error. To overcome this, the user message and the auto-generated message will now be visible at the same time.
This is important to allow any input value to be visible to the users in case the message is used to highlight the failing passed through input. E.g., `assert(/abc/.test(input), input)` should highlight, that `input` is set to `undefined`.
Trott
reviewed
Sep 5, 2018
| * `options` {Object} | ||
| * `message` {string} If provided, the error message is going to be set to this | ||
| value. | ||
| * `message` {any} If provided, it is going to be appended to auto-generated |
Trott
reviewed
Sep 5, 2018
| * `userMessage` {any} Contains the actual passed through message by the user. | ||
| It will not be set in case the user does not provide a error message. | ||
|
|
||
| All error messages thrown by the `assert` module are auto-generated. If the user |
Member
There was a problem hiding this comment.
This sentence is confusing to me. I don't think auto-generated is a clear term and should probably be avoided.
@nodejs/documentation
Member
Author
|
Closing for now. I'll open a new PR when I get to it. |
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.
This is a follow up PR for #22695 but this is currently blocked by #22694. I'll remove the first commit as soon as #22695 lands.
This is important to allow any input value to be visible to the users
in case the message is used to highlight the failing passed through
input.
E.g.,
assert(/abc/.test(input), input)should highlight, thatinputis set to
undefined.Refs: #22695, #22694
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes