diff --git a/lib/internal/webstreams/encoding.js b/lib/internal/webstreams/encoding.js index 9cfea36989a228..f316222ccbf0e8 100644 --- a/lib/internal/webstreams/encoding.js +++ b/lib/internal/webstreams/encoding.js @@ -20,6 +20,7 @@ const { customInspect } = require('internal/webstreams/util'); const { codes: { + ERR_INVALID_ARG_TYPE, ERR_INVALID_THIS, }, } = require('internal/errors'); @@ -134,7 +135,7 @@ class TextDecoderStream { this.#transform = new TransformStream({ transform: (chunk, controller) => { if (chunk === undefined) { - throw new ERR_INVALID_THIS('TextDecoderStream'); + throw new ERR_INVALID_ARG_TYPE('chunk', 'string', chunk); } const value = this.#handle.decode(chunk, { stream: true }); if (value)