-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
assert: accept undefined as message input #22696
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`.
--> | ||
* `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 |
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.
going to be
-> will be
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.
to auto-generated
-> to the
* `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 |
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 sentence is confusing to me. I don't think auto-generated
is a clear term and should probably be avoided.
@nodejs/documentation
Closing for now. I'll open a new PR when I get to it. |
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, thatinput
is set to
undefined
.Refs: #22695, #22694
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes