Bug 256245

Summary: Improve error message for code like "var {a} = undefined;"
Product: WebKit Reporter: Jarred Sumner <jarred>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: mark.lam, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

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
Radar WebKit Bug Importer
Comment 1 2023-05-09 22:32:18 PDT
Note You need to log in before you can comment on or make changes to this bug.