LibJS: Drop the Temporal prefix from TemporalMissingRequiredProperty

This allows us to use it for other exposed JS APIs that accept options
objects.
This commit is contained in:
Idan Horowitz 2021-09-29 00:58:10 +03:00
parent c3810b827a
commit 5ce468338e
Notes: sideshowbarker 2024-07-18 03:21:32 +09:00
5 changed files with 11 additions and 11 deletions

View file

@ -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") \

View file

@ -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

View file

@ -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;

View file

@ -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 {};
}

View file

@ -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).