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

LibJS: Convert to_bigint() to ThrowCompletionOr

This commit is contained in:
Idan Horowitz 2021-10-16 21:52:16 +03:00 committed by Linus Groh
parent b8f101888b
commit e87cea8248
10 changed files with 27 additions and 56 deletions

View file

@ -49,9 +49,7 @@ Value ZonedDateTimeConstructor::construct(FunctionObject& new_target)
auto& global_object = this->global_object();
// 2. Set epochNanoseconds to ? ToBigInt(epochNanoseconds).
auto* epoch_nanoseconds = vm.argument(0).to_bigint(global_object);
if (vm.exception())
return {};
auto* epoch_nanoseconds = TRY_OR_DISCARD(vm.argument(0).to_bigint(global_object));
// 3. If ! IsValidEpochNanoseconds(epochNanoseconds) is false, throw a RangeError exception.
if (!is_valid_epoch_nanoseconds(*epoch_nanoseconds)) {