mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:47:37 +00:00
LibJS: Include time zone name in TemporalInvalidTimeZoneName error
This commit is contained in:
parent
a433727961
commit
d42336312c
4 changed files with 4 additions and 4 deletions
|
@ -240,7 +240,7 @@
|
|||
M(TemporalInvalidTime, "Invalid time") \
|
||||
M(TemporalInvalidTimeString, "Invalid time string '{}'") \
|
||||
M(TemporalInvalidTimeStringUTCDesignator, "Invalid time string '{}': must not contain a UTC designator") \
|
||||
M(TemporalInvalidTimeZoneName, "Invalid time zone name") \
|
||||
M(TemporalInvalidTimeZoneName, "Invalid time zone name '{}'") \
|
||||
M(TemporalInvalidTimeZoneString, "Invalid time zone string '{}'") \
|
||||
M(TemporalInvalidUnitRange, "Invalid unit range, {} is larger than {}") \
|
||||
M(TemporalInvalidYearMonthString, "Invalid year month string '{}'") \
|
||||
|
|
|
@ -1684,7 +1684,7 @@ ThrowCompletionOr<TemporalTimeZone> parse_temporal_time_zone_string(GlobalObject
|
|||
if (name_part.has_value()) {
|
||||
// a. If ! IsValidTimeZoneName(name) is false, throw a RangeError exception.
|
||||
if (!is_valid_time_zone_name(*name_part))
|
||||
return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidTimeZoneName);
|
||||
return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidTimeZoneName, *name_part);
|
||||
|
||||
// b. Set name to ! CanonicalizeTimeZoneName(name).
|
||||
name = canonicalize_time_zone_name(*name_part);
|
||||
|
|
|
@ -65,7 +65,7 @@ ThrowCompletionOr<Object*> TimeZoneConstructor::construct(FunctionObject& new_ta
|
|||
// a. If ! IsValidTimeZoneName(identifier) is false, then
|
||||
if (!is_valid_time_zone_name(identifier)) {
|
||||
// i. Throw a RangeError exception.
|
||||
return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidTimeZoneName);
|
||||
return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidTimeZoneName, identifier);
|
||||
}
|
||||
|
||||
// b. Let canonical be ! CanonicalizeTimeZoneName(identifier).
|
||||
|
|
|
@ -8,7 +8,7 @@ describe("errors", () => {
|
|||
test("Invalid time zone name", () => {
|
||||
expect(() => {
|
||||
new Temporal.TimeZone("foo");
|
||||
}).toThrowWithMessage(RangeError, "Invalid time zone name");
|
||||
}).toThrowWithMessage(RangeError, "Invalid time zone name 'foo'");
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue