From d9cff591b6ce8b1cedcf70a5c9705a966f0f03d4 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Wed, 7 Jul 2021 17:38:45 +0100 Subject: [PATCH] LibJS: Add error message for invalid time zone in Temporal.TimeZone() --- Userland/Libraries/LibJS/Runtime/ErrorTypes.h | 1 + .../Libraries/LibJS/Runtime/Temporal/TimeZoneConstructor.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibJS/Runtime/ErrorTypes.h b/Userland/Libraries/LibJS/Runtime/ErrorTypes.h index fb374a8f13..ffaaa5c2c0 100644 --- a/Userland/Libraries/LibJS/Runtime/ErrorTypes.h +++ b/Userland/Libraries/LibJS/Runtime/ErrorTypes.h @@ -162,6 +162,7 @@ M(StringNonGlobalRegExp, "RegExp argument is non-global") \ M(StringRawCannotConvert, "Cannot convert property 'raw' to object from {}") \ M(StringRepeatCountMustBe, "repeat count must be a {} number") \ + M(TemporalInvalidTimeZoneName, "Invalid time zone name") \ M(ThisHasNotBeenInitialized, "|this| has not been initialized") \ M(ThisIsAlreadyInitialized, "|this| is already initialized") \ M(ToObjectNullOrUndefined, "ToObject on null or undefined") \ diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZoneConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZoneConstructor.cpp index ee49209269..62731fec27 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZoneConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZoneConstructor.cpp @@ -64,7 +64,7 @@ Value TimeZoneConstructor::construct(FunctionObject& new_target) // a. If ! IsValidTimeZoneName(identifier) is false, then if (!is_valid_time_zone_name(identifier)) { // i. Throw a RangeError exception. - vm.throw_exception(global_object); + vm.throw_exception(global_object, ErrorType::TemporalInvalidTimeZoneName); return {}; }