diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2021-09-29 00:58:10 +0300 |
---|---|---|
committer | Idan Horowitz <idan.horowitz@gmail.com> | 2021-09-29 10:09:33 +0300 |
commit | 5ce468338ef8b533d8350529f34002cab19d36aa (patch) | |
tree | b5722a0be8482dd9796a598bbd865fec8b080cc7 | |
parent | c3810b827a86dc1e1211bb58293a3d43c7f8f506 (diff) | |
download | serenity-5ce468338ef8b533d8350529f34002cab19d36aa.zip |
LibJS: Drop the Temporal prefix from TemporalMissingRequiredProperty
This allows us to use it for other exposed JS APIs that accept options
objects.
5 files changed, 11 insertions, 11 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/ErrorTypes.h b/Userland/Libraries/LibJS/Runtime/ErrorTypes.h index c42914cd43..61ffac4bbb 100644 --- a/Userland/Libraries/LibJS/Runtime/ErrorTypes.h +++ b/Userland/Libraries/LibJS/Runtime/ErrorTypes.h @@ -55,6 +55,7 @@ M(JsonBigInt, "Cannot serialize BigInt value to JSON") \ M(JsonCircular, "Cannot stringify circular object") \ M(JsonMalformed, "Malformed JSON string") \ + M(MissingRequiredProperty, "Required property {} is missing or undefined") \ M(NegativeExponent, "Exponent must be positive") \ M(NonExtensibleDefine, "Cannot define property {} on non-extensible object") \ M(NotAConstructor, "{} is not a constructor") \ @@ -199,7 +200,6 @@ M(TemporalInvalidTimeZoneName, "Invalid time zone name") \ M(TemporalInvalidUnitRange, "Invalid unit range, {} is larger than {}") \ M(TemporalMissingOptionsObject, "Required options object is missing or undefined") \ - M(TemporalMissingRequiredProperty, "Required property {} is missing or undefined") \ M(TemporalPlainTimeWithArgumentMustNotHave, "Argument must not have a defined {} property") \ M(TemporalPropertyMustBeFinite, "Property must not be Infinity") \ M(TemporalPropertyMustBePositiveInteger, "Property must be a positive integer") \ diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp index 237add8c2b..5ca8f179cc 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp @@ -1060,7 +1060,7 @@ ThrowCompletionOr<Object*> prepare_temporal_fields(GlobalObject& global_object, // i. If requiredFields contains property, then if (required_fields.contains_slow(property)) { // 1. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::TemporalMissingRequiredProperty, property); + return vm.throw_completion<TypeError>(global_object, ErrorType::MissingRequiredProperty, property); } // ii. If property is in the Property column of Table 13, then // NOTE: The other properties in the table are automatically handled as their default value is undefined diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp index 8e13aee3b7..790ca80e27 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp @@ -703,7 +703,7 @@ ThrowCompletionOr<double> resolve_iso_month(GlobalObject& global_object, Object if (month_code.is_undefined()) { // a. If month is undefined, throw a TypeError exception. if (month.is_undefined()) - return vm.throw_completion<TypeError>(global_object, ErrorType::TemporalMissingRequiredProperty, vm.names.month.as_string()); + return vm.throw_completion<TypeError>(global_object, ErrorType::MissingRequiredProperty, vm.names.month.as_string()); // b. Return month. return month.as_double(); @@ -766,7 +766,7 @@ ThrowCompletionOr<ISODate> iso_date_from_fields(GlobalObject& global_object, Obj // 5. If year is undefined, throw a TypeError exception. if (year.is_undefined()) - return vm.throw_completion<TypeError>(global_object, ErrorType::TemporalMissingRequiredProperty, vm.names.year.as_string()); + return vm.throw_completion<TypeError>(global_object, ErrorType::MissingRequiredProperty, vm.names.year.as_string()); // 6. Let month be ? ResolveISOMonth(fields). auto month = TRY(resolve_iso_month(global_object, *prepared_fields)); @@ -778,7 +778,7 @@ ThrowCompletionOr<ISODate> iso_date_from_fields(GlobalObject& global_object, Obj // 8. If day is undefined, throw a TypeError exception. if (day.is_undefined()) - return vm.throw_completion<TypeError>(global_object, ErrorType::TemporalMissingRequiredProperty, vm.names.day.as_string()); + return vm.throw_completion<TypeError>(global_object, ErrorType::MissingRequiredProperty, vm.names.day.as_string()); // 9. Return ? RegulateISODate(year, month, day, overflow). return regulate_iso_date(global_object, year.as_double(), month, day.as_double(), overflow); @@ -804,7 +804,7 @@ ThrowCompletionOr<ISOYearMonth> iso_year_month_from_fields(GlobalObject& global_ // 5. If year is undefined, throw a TypeError exception. if (year.is_undefined()) - return vm.throw_completion<TypeError>(global_object, ErrorType::TemporalMissingRequiredProperty, vm.names.year.as_string()); + return vm.throw_completion<TypeError>(global_object, ErrorType::MissingRequiredProperty, vm.names.year.as_string()); // 6. Let month be ? ResolveISOMonth(fields). auto month = TRY(resolve_iso_month(global_object, *prepared_fields)); @@ -847,7 +847,7 @@ ThrowCompletionOr<ISOMonthDay> iso_month_day_from_fields(GlobalObject& global_ob // 7. If month is not undefined, and monthCode and year are both undefined, then if (!month_value.is_undefined() && month_code.is_undefined() && year.is_undefined()) { // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::TemporalMissingRequiredProperty, "monthCode or year"); + return vm.throw_completion<TypeError>(global_object, ErrorType::MissingRequiredProperty, "monthCode or year"); } // 8. Set month to ? ResolveISOMonth(fields). @@ -860,7 +860,7 @@ ThrowCompletionOr<ISOMonthDay> iso_month_day_from_fields(GlobalObject& global_ob // 10. If day is undefined, throw a TypeError exception. if (day.is_undefined()) - return vm.throw_completion<TypeError>(global_object, ErrorType::TemporalMissingRequiredProperty, vm.names.day.as_string()); + return vm.throw_completion<TypeError>(global_object, ErrorType::MissingRequiredProperty, vm.names.day.as_string()); // 11. Let referenceISOYear be 1972 (the first leap year after the Unix epoch). i32 reference_iso_year = 1972; diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp index 763d4d025b..e7236155a9 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp @@ -462,7 +462,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::to_zoned_date_time) // 5. If calendarLike is undefined, then if (calendar_like.is_undefined()) { // a. Throw a TypeError exception. - vm.throw_exception<TypeError>(global_object, ErrorType::TemporalMissingRequiredProperty, vm.names.calendar.as_string()); + vm.throw_exception<TypeError>(global_object, ErrorType::MissingRequiredProperty, vm.names.calendar.as_string()); return {}; } @@ -477,7 +477,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::to_zoned_date_time) // 8. If temporalTimeZoneLike is undefined, then if (temporal_time_zone_like.is_undefined()) { // a. Throw a TypeError exception. - vm.throw_exception<TypeError>(global_object, ErrorType::TemporalMissingRequiredProperty, vm.names.timeZone.as_string()); + vm.throw_exception<TypeError>(global_object, ErrorType::MissingRequiredProperty, vm.names.timeZone.as_string()); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp index f06ef34663..ab4d69853f 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp @@ -374,7 +374,7 @@ ThrowCompletionOr<UnregulatedTemporalTime> to_temporal_time_record(GlobalObject& // c. If value is undefined, then if (value.is_undefined()) { // i. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::TemporalMissingRequiredProperty, property); + return vm.throw_completion<TypeError>(global_object, ErrorType::MissingRequiredProperty, property); } // d. Set value to ? ToIntegerThrowOnInfinity(value). |