Replace JSMSG_NOT_BIGINT with more descriptive error messages
Categories
(Core :: JavaScript Engine, enhancement, P3)
Tracking
()
People
(Reporter: anba, Assigned: evilpies)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
https://searchfox.org/mozilla-central/rev/69ace9da347adcc4a33c6fa3d8e074759b91068c/js/src/vm/BigIntType.cpp#2687 should include the type and/or value of v
. So instead of throwing TypeError: not a BigInt
, it should throw TypeError: can't convert xxx to BigInt
.
Example:
js> new BigInt64Array([2])
typein:1:1 TypeError: not a BigInt
Stack:
@typein:1:1
https://searchfox.org/mozilla-central/rev/69ace9da347adcc4a33c6fa3d8e074759b91068c/js/src/vm/TypedArrayObject.cpp#1355 and https://searchfox.org/mozilla-central/rev/69ace9da347adcc4a33c6fa3d8e074759b91068c/js/src/vm/TypedArrayObject.cpp#1768 should include the source and target typed array types or describe somehow that the typed array element types are incompatible.
Example:
js> new BigInt64Array(new Int32Array)
typein:2:1 TypeError: not a BigInt
Stack:
@typein:2:1
![]() |
||
Updated•6 years ago
|
Assignee | ||
Comment 1•6 years ago
|
||
Updated•6 years ago
|
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Comment 2•6 years ago
|
||
I am open to wording improvements for the error message. Right now we get:
js> new BigInt64Array(new Float32Array(4))
TypeError: Float32Array array elements are incompatible with BigInt64Array
and
js> x = new Float32Array(4); x.set(new BigInt64Array(2))
TypeError: BigInt64Array array elements are incompatible with Float32Array
Depends on D57199
![]() |
||
Comment 4•6 years ago
|
||
bugherder |
Assignee | ||
Updated•6 years ago
|
Description
•