Skip to content

Conversation

@sven-oly
Copy link
Collaborator

@sven-oly sven-oly commented Oct 2, 2024

This fixes all the "error" cases in NodeJs for locale display names, moving them to "unsupported". This works for unsupported locale options and also the "root" locale.

Fixes #318

@sven-oly
Copy link
Collaborator Author

sven-oly commented Oct 2, 2024

Fixes #318

Comment on lines 38 to 43
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';
}
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!

@sven-oly
Copy link
Collaborator Author

sven-oly commented Oct 8, 2024

I've updated this to categorize unsupported locale options as "Unsupported". This reduces errors and failures.
image
image

I think this is worth submitting. PTAL.

@sven-oly
Copy link
Collaborator Author

Please review again!

Copy link
Member

@sffc sffc left a comment

Choose a reason for hiding this comment

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

This is not ready. The problem is that the locale is "root" which is not a valid locale.

@sven-oly
Copy link
Collaborator Author

Root locale was removed in PR #341

@sven-oly
Copy link
Collaborator Author

This now checks the requested locale for validity as a locale. It also recognizes problems with getting the result as "unsupported" instead of test failures or errors.

@sven-oly
Copy link
Collaborator Author

Note that there are still test failures in all platforms for a variety of reasons.

@sven-oly
Copy link
Collaborator Author

PTAL. It would be good to resolve this issue #318 .

@sven-oly
Copy link
Collaborator Author

I would like to merge this. It solves a problem that is in Q4 P1 milestones.

@sven-oly
Copy link
Collaborator Author

PTAL

@sven-oly sven-oly merged commit 61b4b84 into unicode-org:main Jan 6, 2025
8 checks passed
@sven-oly sven-oly deleted the fix_node_langname_errors branch August 13, 2025 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Locale display names in Node: change problems with RangeError to "unsupported"

3 participants