buffer: fix backwards incompatibility#12439
Conversation
4a86803 introduced a backwards incompatibility by accident and was not caught due to an existing test that wasn't strict enough. This commit fixes both the backwards incompatibility and the test.
cjihrig
left a comment
There was a problem hiding this comment.
LGTM. Can the parens in lib/buffer.js be dropped though?
|
I'm not opposed to this, but I want to suggest the possibility that we only want this on v7.x and earlier. I'm not sure it makes a lot of sense to have two different error messages for an invalid encoding, so the accidental removal of one of them in 4a86803 arguably makes the error messages better/more consistent and we might as well do it in 8.x.x and forward. I say "arguably" because you could make the case that the one that specifically says "string" is better, and I suspect someone might make that argument. :-D |
|
@cjihrig I prefer to include parens when using conditionals outside of an |
4a86803 introduced a backwards incompatibility by accident and was not caught due to an existing test that wasn't strict enough. This commit fixes both the backwards incompatibility and the test. PR-URL: #12439 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
|
Landed in 7cd0d4f |
|
Depends on #12361. |
4a86803 introduced a backwards incompatibility by accident and was not caught due to an existing test that wasn't strict enough.
This commit fixes both the backwards incompatibility and the test.
This changes does not affect performance.
CI: https://ci.nodejs.org/job/node-test-pull-request/7424/
/cc @Trott
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)