diff options
3 files changed, 4 insertions, 6 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp index 16fda0ea23..59e0a90e7c 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp @@ -900,7 +900,7 @@ ThrowCompletionOr<TemporalDuration> parse_temporal_duration_string(GlobalObject& } // 13.43 ParseTemporalTimeString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporaltimestring -Optional<TemporalTime> parse_temporal_time_string(GlobalObject& global_object, [[maybe_unused]] String const& iso_string) +ThrowCompletionOr<TemporalTime> parse_temporal_time_string(GlobalObject& global_object, [[maybe_unused]] String const& iso_string) { // 1. Assert: Type(isoString) is String. @@ -909,7 +909,7 @@ Optional<TemporalTime> parse_temporal_time_string(GlobalObject& global_object, [ // TODO // 3. Let result be ? ParseISODateTime(isoString). - auto result = TRY_OR_DISCARD(parse_iso_date_time(global_object, iso_string)); + auto result = TRY(parse_iso_date_time(global_object, iso_string)); // 4. Return the Record { [[Hour]]: result.[[Hour]], [[Minute]]: result.[[Minute]], [[Second]]: result.[[Second]], [[Millisecond]]: result.[[Millisecond]], [[Microsecond]]: result.[[Microsecond]], [[Nanosecond]]: result.[[Nanosecond]], [[Calendar]]: result.[[Calendar]] }. return TemporalTime { .hour = result.hour, .minute = result.minute, .second = result.second, .millisecond = result.millisecond, .microsecond = result.microsecond, .nanosecond = result.nanosecond, .calendar = move(result.calendar) }; diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h index 860035fa5c..dc7e4b274f 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h @@ -109,7 +109,7 @@ ThrowCompletionOr<String> parse_temporal_calendar_string(GlobalObject&, String c ThrowCompletionOr<TemporalDate> parse_temporal_date_string(GlobalObject&, String const& iso_string); ThrowCompletionOr<ISODateTime> parse_temporal_date_time_string(GlobalObject&, String const& iso_string); ThrowCompletionOr<TemporalDuration> parse_temporal_duration_string(GlobalObject&, String const& iso_string); -Optional<TemporalTime> parse_temporal_time_string(GlobalObject&, String const& iso_string); +ThrowCompletionOr<TemporalTime> parse_temporal_time_string(GlobalObject&, String const& iso_string); Optional<TemporalTimeZone> parse_temporal_time_zone_string(GlobalObject&, String const& iso_string); Optional<TemporalYearMonth> parse_temporal_year_month_string(GlobalObject&, String const& iso_string); double to_positive_integer(GlobalObject&, Value argument); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp index 9fbc90bd53..37140968f0 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp @@ -108,9 +108,7 @@ ThrowCompletionOr<PlainTime*> to_temporal_time(GlobalObject& global_object, Valu return throw_completion(exception->value()); // b. Let result be ? ParseTemporalTimeString(string). - result = parse_temporal_time_string(global_object, string); - if (auto* exception = vm.exception()) - return throw_completion(exception->value()); + result = TRY(parse_temporal_time_string(global_object, string)); // c. Assert: ! IsValidTime(result.[[Hour]], result.[[Minute]], result.[[Second]], result.[[Millisecond]], result.[[Microsecond]], result.[[Nanosecond]]) is true. VERIFY(is_valid_time(result->hour, result->minute, result->second, result->millisecond, result->microsecond, result->nanosecond)); |