mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:48:10 +00:00
LibJS: Throw an exception in NumberFormat.prototype.format for BigInts
Rather than crashing in the call to as_double(), throw an exception for now.
This commit is contained in:
parent
c65dea64bd
commit
40973814e9
2 changed files with 14 additions and 0 deletions
|
@ -41,6 +41,10 @@ ThrowCompletionOr<Value> NumberFormatFunction::call()
|
|||
// 4. Let x be ? ToNumeric(value).
|
||||
value = TRY(value.to_numeric(global_object));
|
||||
|
||||
// FIXME: Support BigInt number formatting.
|
||||
if (value.is_bigint())
|
||||
return vm.throw_completion<InternalError>(global_object, ErrorType::NotImplemented, "BigInt number formatting");
|
||||
|
||||
// 5. Return ? FormatNumeric(nf, x).
|
||||
// Note: Our implementation of FormatNumeric does not throw.
|
||||
auto formatted = format_numeric(m_number_format, value.as_double());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue