Closed Bug 808340 Opened 13 years ago Closed 8 years ago

Destructuring assignments can return confusing error messages

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: miker, Unassigned)

References

(Blocks 1 open bug)

Details

The following results in the error "values() is undefined": function notvalues() { return [1, 2, 3]; } let [x, y, z] = values(); This is to be expected but the following produces the same error even though values is defined: function values() { return; } let [x, y, z] = values(); Maybe we could return something like "Unable to deconstruct return value."
Assignee: general → nobody
> function notvalues() { > return [1, 2, 3]; > } > > let [x, y, z] = values(); current error message is "ReferenceError: values is not defined", on today's nightly. > function values() { > return; > } > > let [x, y, z] = values(); and "TypeError: values(...) is undefined" for this. I think they're clear enough now.
Resolving as WFM per comment #1.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.