Skip to content

Commit

Permalink
quic: fix error message on invalid connection ID
Browse files Browse the repository at this point in the history
If Buffer.from() throws, it does not return a value, so the error
message is always going to report `undefined`. Use the value passed to
Buffer.from() instead.

PR-URL: #35026
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
Trott committed Sep 5, 2020
1 parent f3b4846 commit 1862305
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/internal/quic/util.js
Expand Up @@ -405,11 +405,11 @@ function validateQuicClientSessionOptions(options = {}) {
if (typeof dcid_value === 'string') {
// If it's a string, it must be a hex encoded string
try {
dcid = Buffer.from(dcid_value, 'hex');
Buffer.from(dcid_value, 'hex');
} catch {
throw new ERR_INVALID_ARG_VALUE(
'options.dcid',
dcid,
dcid_value,
'is not a valid QUIC connection ID');
}
}
Expand Down

0 comments on commit 1862305

Please sign in to comment.