From 186230527b2703652a7b1ff6faeb19bc20a5ed37 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 2 Sep 2020 21:44:15 -0700 Subject: [PATCH] quic: fix error message on invalid connection ID 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: https://github.com/nodejs/node/pull/35026 Reviewed-By: Jiawen Geng Reviewed-By: Luigi Pinca --- lib/internal/quic/util.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/quic/util.js b/lib/internal/quic/util.js index 2116c777238503..e2aa07a4560c14 100644 --- a/lib/internal/quic/util.js +++ b/lib/internal/quic/util.js @@ -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'); } }