| Summary: | Poor Error Message / Call Stack for TypeError: Cannot call a class constructor | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Joseph Pecoraro <joepeck> |
| Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW --- | ||
| Severity: | Normal | CC: | bburg, ggaren, joepeck, rniwa, saam, ysuzuki |
| Priority: | P2 | ||
| Version: | 528+ (Nightly build) | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Also it might be good to use the class' name if it has one. It might not though. |
* SUMMARY Poor Error Message / Call Stack for TypeError: Cannot call a class constructor. It points to the "constructor" instead of the "call" site. * TEST: 1 <script> 2 class MyClass { 3 constructor() { this.name = "name"; } 4 } 5 function OtherClass() { 6 MyClass.call(this); 7 } 8 x = new OtherClass; 9 </script> * STEPS TO REPRODUCE 1. Run attached test case => Error in console points to the "constructor" line, expected it to point to the frame above, the "call" site. TypeError: Cannot call a class constructor MyClass test.html:3 OtherClass test.html:6 (anonymous function) test.html:8 * NOTES - Inspector currently has an off by 1 error in its stack trace output which is getting corrected at the moment.