errors,tls_wrap: migrate to use internal/errors.js#13476
errors,tls_wrap: migrate to use internal/errors.js#13476refack merged 1 commit intonodejs:masterfrom
Conversation
lib/internal/errors.js
Outdated
There was a problem hiding this comment.
The code should likely be a bit more specific... e.g. ERR_TLS_RENEGOTIATION_FAILED, etc
lib/internal/errors.js
Outdated
There was a problem hiding this comment.
this would need to be
assert.strictEqual(e.code, 'ERR_DH_PARAM_SIZE');There was a problem hiding this comment.
In this file, e is of type Object Error. This doesn't have the field e.code which we can access, so I believe, this one will be more appropriate in that case.
I have written a small test-case and verified that:
var u = require('util')
var e = new Error('ERR_DH_PARAM_SIZE');
console.log(u.inspect(e, {showHidden: true}))`Output:
at Object.<anonymous> (/home/bidisha/swe_node/n1/node/foo.js:2:9)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Function.Module.runMain (module.js:605:10)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:575:3
[stack]: 'Error: ERR_DH_PARAM_SIZE\n at Object.<anonymous> (/home/bidisha/swe_node/n1/node/foo.js:2:9)\n at Module._compile (module.js:569:30)\n at Object.Module._extensions..js (module.js:580:10)\n at Module.load (module.js:503:32)\n at tryModuleLoad (module.js:466:12)\n at Function.Module._load (module.js:458:3)\n at Function.Module.runMain (module.js:605:10)\n at startup (bootstrap_node.js:158:16)\n at bootstrap_node.js:575:3',
[message]: 'ERR_DH_PARAM_SIZE' }`
Please suggest on this.
There was a problem hiding this comment.
Sorry for the incorrect observation above.
Now, things seems to be resolved.
Thanks!
lib/internal/errors.js
Outdated
lib/internal/errors.js
Outdated
There was a problem hiding this comment.
maybe 'ERR_TLS_SESSION_CALLBACK_ALREADY_CALLED'
lib/internal/errors.js
Outdated
There was a problem hiding this comment.
Maybe add "_ALREADY_CALLED" to these 2 as well. It does make the code long but it also makes it clearer what's going wrong.
47f3eff to
9a86f6d
Compare
b7dcebb to
45c9e10
Compare
lib/_tls_wrap.js
Outdated
There was a problem hiding this comment.
s/ERR_RENEGOTIATE/ERR_TLS_RENEGOTIATE ?
lib/_tls_wrap.js
Outdated
There was a problem hiding this comment.
s/ERR_REQD_SERVER_NAME/ERR_TLS_REQUIRED_SERVER_NAME ?
lib/_tls_wrap.js
Outdated
There was a problem hiding this comment.
s/ERR_DH_PARAM_SIZE/ERR_TLS_DH_PARAM_SIZE ?
lib/internal/errors.js
Outdated
There was a problem hiding this comment.
this is hard coding the param size. it shouldn't be.
E('ERR_DH_PARAM_SIZE', (size) => `DH parameter size ${size} is less than 2048`);
lib/internal/errors.js
Outdated
There was a problem hiding this comment.
I would take the opportunity to reword this a bit:
'The session callback was called more than once'
lib/internal/errors.js
Outdated
There was a problem hiding this comment.
Actually... making this a generic error would make more sense, e.g.
E('ERR_MULTIPLE_CALLBACK',
(name) => `The ${name} callback was called more than once`);
jasnell
left a comment
There was a problem hiding this comment.
Getting closer but left a few comments that need to be addressed. Thank you!
cacf0d9 to
bec79c7
Compare
|
Your suggestions are addressed. |
|
Needs a rebase and then we can land. |
lib/internal/errors.js
Outdated
de7f1f7 to
dbe7f78
Compare
refack
left a comment
There was a problem hiding this comment.
LGTM (except for the leaked lines in errors.js)
lib/internal/errors.js
Outdated
There was a problem hiding this comment.
This is a rebase leak...
Could you go over this list and keep only the ERRs you need for this PR
There was a problem hiding this comment.
Removed all unrelated ERRs to this PR. Thanks! @refack.
lib/internal/errors.js
Outdated
There was a problem hiding this comment.
This is a redefinition of ERR_MULTIPLE_CALLBACK from L162 this causes the error message to change.
- You can just remove this one and use the one in L162
- You can remove this one and improve L162 (and update its usages)
- [Optional] You could sort this whole block alphabetically (very easy if your IDE supports that, otherwise ignore)
- You can open an issue that
E()doesn't fail for redefinition, or even better a PR that makes it fail 😉
not ok 1108 parallel/test-stream-transform-callback-twice
---
duration_ms: 0.61
severity: fail
stack: |-
assert.js:55
throw new errors.AssertionError({
^
AssertionError [ERR_ASSERTION]: 'The undefined callback was called more than once' === 'Callback called multiple times'
at Transform.<anonymous> (/data/iojs/build/workspace/node-test-commit-linuxone/nodes/rhel72-s390x/test/common/index.js:716:14)
at emitOne (events.js:115:13)
at Transform.emit (events.js:210:7)
at Transform.afterTransform (_stream_transform.js:80:17)
at Transform.transform [as _transform] (/data/iojs/build/workspace/node-test-commit-linuxone/nodes/rhel72-s390x/test/parallel/test-stream-transform-callback-twice.js:5:37)
at Transform._read (_stream_transform.js:185:10)
at Transform._write (_stream_transform.js:173:12)
at doWrite (_stream_writable.js:371:12)
at writeOrBuffer (_stream_writable.js:357:5)
at Transform.Writable.write (_stream_writable.js:274:11)
...There was a problem hiding this comment.
Thanks for the suggestion @refack
I have redefined the error message accordingly but this lead to change of another test file: test-stream-transform-callback-twice.js
Hope that is fine with this PR.
Thank you!
There was a problem hiding this comment.
The change to test-stream-transform-callback-twice.js is good by me, but IMHO you should just remote L162, since this line simply overrides it anyway (there's no other magic).
lib/internal/errors.js
Outdated
There was a problem hiding this comment.
The change to test-stream-transform-callback-twice.js is good by me, but IMHO you should just remote L162, since this line simply overrides it anyway (there's no other magic).
lib/internal/errors.js
Outdated
There was a problem hiding this comment.
This does not look right to me. 'The undefined callback...'
There was a problem hiding this comment.
I have reverted the message back back. Please have a look!
lib/internal/errors.js
Outdated
There was a problem hiding this comment.
Related to my comment above. Agree with @refack that the duplicate line above needs to be removed.
There was a problem hiding this comment.
Should we not be updating the code that generates this error so that it does not have 'undefined' but an indication of what the callback is ?
There was a problem hiding this comment.
Referring to the suggestions above, error message on this file is also redefined.
Please suggest me on that!
Thank You! @mhdawson
mhdawson
left a comment
There was a problem hiding this comment.
Very close just a few more comments.
2b58918 to
32a6d1a
Compare
|
Thank you all, for guiding me on this PR @mhdawson @refack @jasnell @gireeshpunathil |
lib/internal/errors.js
Outdated
There was a problem hiding this comment.
The only remaining thing I see here is making sure that the error codes are in alphabetical order.
|
@bidipyne non-blocking observation. You changed 15 Error generating LOCs, and added 6 new Error codes, but fixed only 3 tests. |
mhdawson
left a comment
There was a problem hiding this comment.
LGTM once order of messages is fixed. Please comment when you have done that and we can start the CI.
PR-URL: nodejs#13476 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
|
Addressed nit and landed |
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
tls_wrap.js, internal/errors.js
I read and understood the contribution guidelines, please review and suggest.
@jasnell
Thanks.