WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
256245
Improve error message for code like "var {a} = undefined;"
https://bugs.webkit.org/show_bug.cgi?id=256245
Summary
Improve error message for code like "var {a} = undefined;"
Jarred Sumner
Reported
2023-05-02 22:31:23 PDT
Currently, the following code:
> await Promise.resolve(undefined).then(({default: a}) => a.true())
Produces the following messages:
> TypeError: Right side of assignment cannot be destructured
Instead, something closer to V8's message would be clearer:
> TypeError: Cannot read properties of undefined
It looks like the message is generated here:
https://github.com/WebKit/WebKit/blob/8c684cfbe8afa5cb7eea0e46408cbdd31e920ba1/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp#L5607
It looks like the object can be at least null or undefined when this error is thrown, but it seems like most of these error messages are statically allocated which makes it harder to change them?
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2023-05-09 22:32:18 PDT
<
rdar://problem/109136179
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug