fix(cli): redact config and organization JSON parse refusals (#1873)
This commit was merged in pull request #1908.
This commit is contained in:
1 parent
6f0c72a02f
commit
8f7de8c4d3
3 files changed
+63
-4
No files matched your search
@@ -133,7 +133,7 @@ function readMarker(dataRoot) {
|
||||
try {
|
||||
marker = JSON.parse(fs.readFileSync(file, "utf8"));
|
||||
} catch (error) {
|
||||
fail(3, `instance-root-unclaimed: ${file} is not a valid marker (${error.message})`);
|
||||
fail(3, `instance-root-unclaimed: ${file} is not a valid marker (${error instanceof SyntaxError ? 'not valid JSON' : error.message})`);
|
||||
}
|
||||
if (!isPlainObject(marker) || Object.keys(marker).sort().join(",") !== "instanceVersion,name"
|
||||
|| marker.instanceVersion !== 1 || typeof marker.name !== "string" || !INSTANCE_PATTERN.test(marker.name)) {
|
||||
@@ -382,8 +382,8 @@ async function load(file, instance = null) {
|
||||
let document;
|
||||
try {
|
||||
document = JSON.parse(raw);
|
||||
} catch (error) {
|
||||
fail(2, `configuration is not valid JSON (${file}): ${error.message}`);
|
||||
} catch {
|
||||
fail(2, `configuration is not valid JSON (${file})`);
|
||||
}
|
||||
return await validate(document, file);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user