buffer: improve Blob constructor error message when passing a string

resolve: https://github.com/nodejs/node/issues/38856

PR-URL: https://github.com/nodejs/node/pull/42338
Fixes: https://github.com/nodejs/node/issues/38856
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Xuguang Mei 2022-04-05 03:14:39 +08:00 committed by GitHub
parent 54819f08e0
commit 46b633f441
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -138,7 +138,7 @@ class Blob {
if (sources === null ||
typeof sources[SymbolIterator] !== 'function' ||
typeof sources === 'string') {
throw new ERR_INVALID_ARG_TYPE('sources', 'Iterable', sources);
throw new ERR_INVALID_ARG_TYPE('sources', 'a sequence', sources);
}
validateObject(options, 'options');
let {