Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Apr 4, 2022
Merged

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

merged 1 commit into from
Apr 4, 2022

Conversation

meixg
Copy link
Member

@meixg meixg commented Mar 15, 2022

resolve: #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 #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-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Mar 15, 2022
@aduh95 aduh95 requested a review from jasnell March 15, 2022 12:06
@meixg meixg added the request-ci Add this label to start a Jenkins CI on a PR. label Mar 17, 2022
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Mar 17, 2022
@nodejs-github-bot
Copy link
Collaborator

@meixg meixg added the request-ci Add this label to start a Jenkins CI on a PR. label Mar 21, 2022
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Mar 21, 2022
@nodejs-github-bot
Copy link
Collaborator

@meixg meixg added the request-ci Add this label to start a Jenkins CI on a PR. label Mar 21, 2022
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Mar 21, 2022
@nodejs-github-bot
Copy link
Collaborator

@@ -137,7 +137,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);
Copy link
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
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@aduh95 aduh95 added the commit-queue Add this label to land a pull request using GitHub Actions. label Apr 4, 2022
@nodejs-github-bot nodejs-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:master Apr 4, 2022
@nodejs-github-bot
Copy link
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#42338
Fixes: 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: #42338
Fixes: #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: #42338
Fixes: #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#42338
Fixes: 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: #42338
Fixes: #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: #42338
Fixes: #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: #42338
Fixes: #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: #42338
Fixes: #38856
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
guangwong pushed a commit to noslate-project/node that referenced this pull request Oct 10, 2022
resolve: nodejs/node#38856

PR-URL: nodejs/node#42338
Fixes: 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 free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-ci PRs 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