From 1ec5d757e64c86b45145d8a388d4befb74810776 Mon Sep 17 00:00:00 2001 From: Martok Date: Sun, 4 Jun 2023 16:47:15 +0200 Subject: Issue #1969 Follow-Up: Error reporting arguments in RelativeTimeFormat/DateTimeFormat --- js/src/builtin/intl/DateTimeFormat.cpp | 6 ++++-- js/src/builtin/intl/RelativeTimeFormat.js | 2 +- js/src/js.msg | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'js/src') diff --git a/js/src/builtin/intl/DateTimeFormat.cpp b/js/src/builtin/intl/DateTimeFormat.cpp index 2ac50897fe..5aa8e0d7a2 100644 --- a/js/src/builtin/intl/DateTimeFormat.cpp +++ b/js/src/builtin/intl/DateTimeFormat.cpp @@ -558,7 +558,8 @@ static bool intl_FormatDateTime(JSContext* cx, UDateFormat* df, double x, MutableHandleValue result) { if (!IsFinite(x)) { - JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_DATE_NOT_FINITE); + JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_DATE_NOT_FINITE, + "DateTimeFormat", "format"); return false; } @@ -664,7 +665,8 @@ static bool intl_FormatToPartsDateTime(JSContext* cx, UDateFormat* df, double x, MutableHandleValue result) { if (!IsFinite(x)) { - JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_DATE_NOT_FINITE); + JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_DATE_NOT_FINITE, + "DateTimeFormat", "formatToParts"); return false; } diff --git a/js/src/builtin/intl/RelativeTimeFormat.js b/js/src/builtin/intl/RelativeTimeFormat.js index 7cb8d3b083..1118df9025 100644 --- a/js/src/builtin/intl/RelativeTimeFormat.js +++ b/js/src/builtin/intl/RelativeTimeFormat.js @@ -191,7 +191,7 @@ function Intl_RelativeTimeFormat_format(value, unit) { // PartitionRelativeTimePattern, step 4. if (!Number_isFinite(t)) { - ThrowRangeError(JSMSG_DATE_NOT_FINITE, "RelativeTimeFormat"); + ThrowRangeError(JSMSG_DATE_NOT_FINITE, "RelativeTimeFormat", "format"); } // PartitionRelativeTimePattern, step 5. diff --git a/js/src/js.msg b/js/src/js.msg index 91637edc6a..fe69fba60c 100644 --- a/js/src/js.msg +++ b/js/src/js.msg @@ -484,7 +484,7 @@ MSG_DEF(JSMSG_DEBUG_PROMISE_NOT_REJECTED, 0, JSEXN_TYPEERR, "Promise hasn't been MSG_DEF(JSMSG_TRACELOGGER_ENABLE_FAIL, 1, JSEXN_ERR, "enabling tracelogger failed: {0}") // Intl -MSG_DEF(JSMSG_DATE_NOT_FINITE, 0, JSEXN_RANGEERR, "date value is not finite in DateTimeFormat.format()") +MSG_DEF(JSMSG_DATE_NOT_FINITE, 2, JSEXN_RANGEERR, "date value is not finite in {0}.{1}()") MSG_DEF(JSMSG_INTERNAL_INTL_ERROR, 0, JSEXN_ERR, "internal error while computing Intl data") MSG_DEF(JSMSG_INTL_OBJECT_NOT_INITED, 3, JSEXN_TYPEERR, "Intl.{0}.prototype.{1} called on value that's not an object initialized as a {2}") MSG_DEF(JSMSG_INTL_OBJECT_REINITED, 0, JSEXN_TYPEERR, "can't initialize object twice as an object of an Intl constructor") -- cgit v1.2.3