Open
Bug 1423721
Opened 7 years ago
Updated 1 year ago
Inconsistent error message for "instanceof" right-hand-side.
Categories
(Core :: JavaScript Engine, enhancement, P5)
Core
JavaScript Engine
Tracking
()
NEW
People
(Reporter: nbp, Unassigned)
References
(Blocks 1 open bug)
Details
Currently, we have 2 different error messages for instanceof right-hand-side:
TypeError: invalid 'instanceof' operand …
TypeError: … is not a function
I suggest to replace both of these messages by a single one which says:
TypeError: invalid right-hand-side operand of 'instanceof', expected a function, got …
js> 4 instanceof 5
TypeError: invalid 'instanceof' operand 5
js> [1,2,3] instanceof [];
TypeError: [] is not a function
js> [1,2,3] instanceof []
TypeError: [] is not a function
js> [1,2,3] instanceof {}
TypeError: ({}) is not a function
js> [1,2,3] instanceof ""
TypeError: invalid 'instanceof' operand ""
js> var x = [];
js> [1,2,3] instanceof x
TypeError: x is not a function
Reporter | ||
Updated•7 years ago
|
Priority: -- → P4
Updated•2 years ago
|
Severity: normal → S3
Updated•1 year ago
|
Priority: P4 → P5
Comment 1•1 year ago
|
||
sometimes websites use the error message as condition, and changing the error message can result in breakage.
e.g. bug 1259822 caused bug 1490772, bug 1498257, and bug 1512401
while it's nice to improve the error message, we should prepare for breakage and fallback plan.
Blocks: jserror
You need to log in
before you can comment on or make changes to this bug.
Description
•