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: nodejs#35026
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
Trott authored and joesepi committed Oct 22, 2020
1 parent b0744b8 commit 635273d
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 635273d

Please sign in to comment.