Skip to content

buffer: improve Blob constructor error message when passing a string - #42338

Merged
nodejs-github-bot merged 1 commit into
nodejs:masterfrom
meixg:buffer-blob-err-meixg
Apr 4, 2022
Merged

buffer: improve Blob constructor error message when passing a string#42338
nodejs-github-bot merged 1 commit into
nodejs:masterfrom
meixg:buffer-blob-err-meixg

Conversation

@meixg

Copy link
Copy Markdown
Member

resolve: #38856

newBlob('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 #38856 (comment):

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

@nodejs-github-botnodejs-github-bot added the needs-ci PRs that need a full CI run. label Mar 15, 2022
@aduh95
aduh95 requested a review from jasnellMarch 15, 2022 12:06
@meixgmeixg added the request-ci Add this label to start a Jenkins CI on a PR. label Mar 17, 2022
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Mar 17, 2022
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@meixgmeixg added the request-ci Add this label to start a Jenkins CI on a PR. label Mar 21, 2022
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Mar 21, 2022
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@meixgmeixg added the request-ci Add this label to start a Jenkins CI on a PR. label Mar 21, 2022
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Mar 21, 2022
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Comment threadlib/internal/blob.js
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);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

definitely better. might be worth indicating a sequence of what tho

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@aduh95aduh95 added the commit-queue Add this label to land a pull request using GitHub Actions. label Apr 4, 2022
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Apr 4, 2022
@nodejs-github-bot
nodejs-github-bot merged commit 46b633f into nodejs:masterApr 4, 2022
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 46b633f

juanarbol pushed a commit to juanarbol/node that referenced this pull request Apr 5, 2022
resolve: nodejs#38856
PR-URL: nodejs#42338Fixes: nodejs#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 was referenced Apr 5, 2022
juanarbol pushed a commit that referenced this pull request Apr 6, 2022
resolve: #38856
PR-URL: #42338Fixes: #38856
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
juanarbol pushed a commit that referenced this pull request Apr 6, 2022
resolve: #38856
PR-URL: #42338Fixes: #38856
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
xtx1130 pushed a commit to xtx1130/node that referenced this pull request Apr 25, 2022
resolve: nodejs#38856
PR-URL: nodejs#42338Fixes: nodejs#38856
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
juanarbol pushed a commit that referenced this pull request May 31, 2022
resolve: #38856
PR-URL: #42338Fixes: #38856
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
danielleadams pushed a commit that referenced this pull request Jun 27, 2022
resolve: #38856
PR-URL: #42338Fixes: #38856
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this pull request Jul 11, 2022
resolve: #38856
PR-URL: #42338Fixes: #38856
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this pull request Jul 31, 2022
resolve: #38856
PR-URL: #42338Fixes: #38856
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@targostargos mentioned this pull request Aug 3, 2022
guangwong pushed a commit to noslate-project/node that referenced this pull request Oct 10, 2022
resolve: nodejs/node#38856
PR-URL: nodejs/node#42338Fixes: nodejs/node#38856
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ciPRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Blob constructor error message when passing a string is misleading

5 participants

@meixg@nodejs-github-bot@jasnell@benjamingr@aduh95