Skip to content
18 changes: 15 additions & 3 deletions executors/node/localedisplaynames.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ module.exports = {
"error_type": "unsupported",
"error_retry": false // Do not repeat
};
if (error instanceof RangeError) {
// The locale can't be handled for some reason!
outputLine["error_type"] = 'unsupported';
outputLine["unsupported"] = error.toString();
outputLine["error_detail"] = 'unsupported locale';
}
Comment on lines +38 to +68
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error instanceof RangeError seems a bit broad. I suggest a narrower case for returning unsupported.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, there are two types of failures right now. Here's what I see being caught as exceptions:

  1. Unexpected options in the locale spec, e.g., "label":"0009","language_label":"en-u-nu-deva-t-de","locale_label":"en"

--> "RangeError: invalid_argument"

  1. "root" locale --> "RangeError: invalid_argument" in the constructor.

Should either of these be "unsupported"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think classifying these as "unsupported" is correct. This will resolve a large number of "errors" --> "unsupported", i.e.,

Report created: 2024-10-07 10:36

1,990 attempted. Pass: 1,460, Fail: 214, Errors: 316, Unsupported: 0

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL!

return outputLine;
}

Expand All @@ -45,13 +51,19 @@ module.exports = {
"result": resultString
};
} catch (error) {
const error_string = error.toString();
outputLine = {"label": json['label'],
"locale_label": locale,
"language_label": input,
"result": resultString,
"error": error.toString(),
"actual_options": options.toString()
"error": error_string,
"actual_options": options.toString(),
};
outputLine["error_type"] = 'unsupported';
outputLine["unsupported"] = error_string;
if (error instanceof RangeError) {
// The locale can't be handled for some reason!
outputLine["error_detail"] = 'unsupported locale';
}
}
return outputLine;
}
Expand Down