Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.3k
module: improve error message for invalid data URL#37701
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
aduh95 commented Mar 10, 2021 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
114e4c8 to 68fcf83Comparetargos commented Mar 12, 2021
@nodejs/modules |
Uh oh!
There was an error while loading. Please reload this page.
DerekNonGeneric left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just my 2¢. Not sure that error code has been used for this purpose historically.
Uh oh!
There was an error while loading. Please reload this page.
bmeck commented Mar 12, 2021
CC: @ljharb since this mentions MIME to user |
bmeck commented Mar 12, 2021
to clarify a bit, these should have been picked up and could have been generated in the past |
ljharb commented Mar 12, 2021
Seems fine to me, since anyone using a data URL is already familiar with MIMEs (this is ofc not true for almost every other specifier category). |
aduh95 commented Apr 2, 2021
Ping @nodejs/modules for reviews. |
DerekNonGeneric left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from my outstanding comments (non-blocking), everything else looks pretty good to me.
I will be digging around this part of codebase in a few days, so I will report back if I find issues.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
guybedford left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps Unsupported MIME "text/plain" loading "data:text/plain,export default 0".
Also it could be nice if we could support the parent context for tracing where it comes from eg if it were import('data:...') in a module, it helps to know where the import expression is.
aduh95 commented Apr 2, 2021
@guybedford Agreed, although I think this would deserve its own PR to align with other |
nodejs-github-bot commented Apr 2, 2021
guybedford commented Apr 2, 2021
@aduh95 I do think it's important to move the "unsupported MIME" part to the beginning of the message though. This is because the data URL could be of any length, so that when scanning the error the user should be able to easily see the "unsupported MIME" part first. It also fixes that the current error isn't quite gramatically complete without a comma or colon or something type of break otherwise. Alternatively to make it gramatically correct:
|
nodejs-github-bot commented Apr 2, 2021
aduh95 commented Apr 2, 2021
I went to the last suggestion as it was the easiest to implement. I think you have a point regarding very long specifiers occulting the reason, maybe we can fix that in a similar way as proposed in #37852 (comment)? |
DerekNonGeneric commented Apr 2, 2021
I believe the feature request outlined in #37581 is precisely the error property we need. |
nodejs-github-bot commented Apr 2, 2021
Fixes: nodejs#37647 PR-URL: nodejs#37701 Reviewed-By: Derek Lewis <[email protected]> Reviewed-By: Guy Bedford <[email protected]>
f5ed39f to 46062a0Compareaduh95 commented Apr 3, 2021
Landed in 46062a0 |
Fixes: #37647 PR-URL: #37701 Reviewed-By: Derek Lewis <[email protected]> Reviewed-By: Guy Bedford <[email protected]>
Fixes: #37647 PR-URL: #37701 Reviewed-By: Derek Lewis <[email protected]> Reviewed-By: Guy Bedford <[email protected]>
Fixes: #37647 PR-URL: #37701 Reviewed-By: Derek Lewis <[email protected]> Reviewed-By: Guy Bedford <[email protected]>
Fixes: #37647
Changes the error message when importing module with an unknown/unsupported MIME type from:
to