Issue #1969 Follow-Up: Error reporting arguments in RelativeTimeFormat/DateTimeFormat

This commit is contained in:
Martok 2023-06-04 16:47:15 +02:00 committed by roytam1
commit 5a531ea80c
3 changed files with 6 additions and 4 deletions

View file

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

View file

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

View file

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