Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src, doc: improve documentation and error message for ICU data fallback #49666

Closed
wants to merge 2 commits into from

Conversation

joyeecheung
Copy link
Member

src: improve error message when ICU data cannot be initialized

Previously when we fail to initialize ICU data, the error message is

could not initialize ICU (check NODE_ICU_DATA or --icu-data-dir
parameters)

This patch updates it to something similar to:

U_FILE_ACCESS_ERROR: Could not initialize ICU. Check the directory
specified by NODE_ICU_DATA or --icu-data-dir contains icudt73l.dat
and it's readable

Where the expected data file name is the same as U_ICUDATA_NAME.

doc: improve documentation about ICU data fallback

This patch:

  • Documents --with-icu-default-data-dir and its precedence
  • Elaborates a bit more about the format of the name of the expected
    data file.

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/startup

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Sep 15, 2023
@joyeecheung joyeecheung added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 15, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 15, 2023
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@@ -38,7 +38,7 @@
namespace node {
namespace i18n {

bool InitializeICUDirectory(const std::string& path);
bool InitializeICUDirectory(const std::string& path, std::string* error);
Copy link
Member

Choose a reason for hiding this comment

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

Just curious, why std::string* and not const std::string&?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is an out parameter, the caller gets the error string if it fails

@nodejs-github-bot
Copy link
Collaborator

@joyeecheung
Copy link
Member Author

Fixed the line length to make the linter happy

@joyeecheung joyeecheung added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 18, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 18, 2023
@nodejs-github-bot
Copy link
Collaborator

Previously when we fail to initialize ICU data, the error message is

```
could not initialize ICU (check NODE_ICU_DATA or --icu-data-dir
parameters)
```

This patch updates it to something similar to:

```
U_FILE_ACCESS_ERROR: Could not initialize ICU. Check the directory
specified by NODE_ICU_DATA or --icu-data-dir contains icudt73l.dat
and it's readable
```

Where the expected data file name is the same as U_ICUDATA_NAME.
This patch:

- Documents `--with-icu-default-data-dir` and its precedence
- Elaborates a bit more about the format of the name of the expected
  data file.
@joyeecheung
Copy link
Member Author

Apparently test-icu-data-dir was matching the old error messages. Updated the test a bit.

@joyeecheung
Copy link
Member Author

@richardlau @jasnell I've updated the test for new error message matches. Can you take a look again? Thanks

@nodejs-github-bot
Copy link
Collaborator

@joyeecheung joyeecheung added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 18, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 18, 2023
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@joyeecheung joyeecheung added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-rebase Add this label to allow the Commit Queue to land a PR in several commits. labels Sep 22, 2023
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Sep 22, 2023
@nodejs-github-bot
Copy link
Collaborator

Landed in c2cd744...db5e993

nodejs-github-bot pushed a commit that referenced this pull request Sep 22, 2023
Previously when we fail to initialize ICU data, the error message is

```
could not initialize ICU (check NODE_ICU_DATA or --icu-data-dir
parameters)
```

This patch updates it to something similar to:

```
U_FILE_ACCESS_ERROR: Could not initialize ICU. Check the directory
specified by NODE_ICU_DATA or --icu-data-dir contains icudt73l.dat
and it's readable
```

Where the expected data file name is the same as U_ICUDATA_NAME.

PR-URL: #49666
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
nodejs-github-bot pushed a commit that referenced this pull request Sep 22, 2023
This patch:

- Documents `--with-icu-default-data-dir` and its precedence
- Elaborates a bit more about the format of the name of the expected
  data file.

PR-URL: #49666
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
ruyadorno pushed a commit that referenced this pull request Sep 28, 2023
Previously when we fail to initialize ICU data, the error message is

```
could not initialize ICU (check NODE_ICU_DATA or --icu-data-dir
parameters)
```

This patch updates it to something similar to:

```
U_FILE_ACCESS_ERROR: Could not initialize ICU. Check the directory
specified by NODE_ICU_DATA or --icu-data-dir contains icudt73l.dat
and it's readable
```

Where the expected data file name is the same as U_ICUDATA_NAME.

PR-URL: #49666
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
ruyadorno pushed a commit that referenced this pull request Sep 28, 2023
This patch:

- Documents `--with-icu-default-data-dir` and its precedence
- Elaborates a bit more about the format of the name of the expected
  data file.

PR-URL: #49666
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This was referenced Sep 28, 2023
alexfernandez pushed a commit to alexfernandez/node that referenced this pull request Nov 1, 2023
Previously when we fail to initialize ICU data, the error message is

```
could not initialize ICU (check NODE_ICU_DATA or --icu-data-dir
parameters)
```

This patch updates it to something similar to:

```
U_FILE_ACCESS_ERROR: Could not initialize ICU. Check the directory
specified by NODE_ICU_DATA or --icu-data-dir contains icudt73l.dat
and it's readable
```

Where the expected data file name is the same as U_ICUDATA_NAME.

PR-URL: nodejs#49666
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
alexfernandez pushed a commit to alexfernandez/node that referenced this pull request Nov 1, 2023
This patch:

- Documents `--with-icu-default-data-dir` and its precedence
- Elaborates a bit more about the format of the name of the expected
  data file.

PR-URL: nodejs#49666
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. commit-queue-rebase Add this label to allow the Commit Queue to land a PR in several commits. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants