1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:07:46 +00:00

LibJS: Make JS::number_to_string() infallible

Work towards #20449.
This commit is contained in:
Andreas Kling 2023-08-09 08:03:12 +02:00
parent 09547ec975
commit b8f78c0adc
9 changed files with 66 additions and 68 deletions

View file

@ -298,7 +298,7 @@ ThrowCompletionOr<String> MathematicalValue::to_string(VM& vm) const
{
return m_value.visit(
[&](double value) -> ThrowCompletionOr<String> {
return TRY_OR_THROW_OOM(vm, number_to_string(value, NumberToStringMode::WithoutExponent));
return number_to_string(value, NumberToStringMode::WithoutExponent);
},
[&](Crypto::SignedBigInteger const& value) -> ThrowCompletionOr<String> {
return TRY_OR_THROW_OOM(vm, value.to_base(10));