-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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. PR-URL: #49666 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: James M Snell <jasnell@gmail.com>
- Loading branch information
1 parent
7c2060c
commit 10a2ade
Showing
4 changed files
with
41 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,33 @@ | ||
// Flags: --expose-internals | ||
'use strict'; | ||
const common = require('../common'); | ||
const { spawnSyncAndExit } = require('../common/child_process'); | ||
const { internalBinding } = require('internal/test/binding'); | ||
const os = require('os'); | ||
|
||
const { hasSmallICU } = internalBinding('config'); | ||
if (!(common.hasIntl && hasSmallICU)) | ||
common.skip('missing Intl'); | ||
|
||
const assert = require('assert'); | ||
const { spawnSync } = require('child_process'); | ||
|
||
const expected = | ||
'could not initialize ICU (check NODE_ICU_DATA or ' + | ||
`--icu-data-dir parameters)${os.EOL}`; | ||
|
||
{ | ||
const child = spawnSync(process.execPath, ['--icu-data-dir=/', '-e', '0']); | ||
assert(child.stderr.toString().includes(expected)); | ||
spawnSyncAndExit( | ||
process.execPath, | ||
['--icu-data-dir=/', '-e', '0'], | ||
{ | ||
status: 9, | ||
signal: null, | ||
stderr: /Could not initialize ICU/ | ||
}); | ||
} | ||
|
||
{ | ||
const env = { ...process.env, NODE_ICU_DATA: '/' }; | ||
const child = spawnSync(process.execPath, ['-e', '0'], { env }); | ||
assert(child.stderr.toString().includes(expected)); | ||
spawnSyncAndExit( | ||
process.execPath, | ||
['-e', '0'], | ||
{ env }, | ||
{ | ||
status: 9, | ||
signal: null, | ||
stderr: /Could not initialize ICU/ | ||
}); | ||
} |