Skip to content

buffer: improve Blob constructor error message when passing a string

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

new Blob('nodejs')

before:

TypeError [ERR_INVALID_ARG_TYPE]: The "sources" argument must be an instance of Iterable. Received type string ('nodejs')

after:

TypeError [ERR_INVALID_ARG_TYPE]: The "sources" argument must be a sequence. Received type string ('nodejs')

ref https://github.com/nodejs/node/issues/38856#issuecomment-851039089:

error messages thrown by some browsers: Chromium: TypeError: Failed to construct 'Blob': The provided value cannot be converted to a sequence. Firefox: TypeError: Blob constructor: Argument 1 can't be converted to a sequence. Safari: TypeError: Value is not a sequence

Merge request reports

Loading