chore: 🤖 support api_errors and drop errors format flag
This commit is contained in:
2 files changed
+9
-4
No files matched your search
@@ -18,8 +18,10 @@ const escapeAndValidateBase62 = (str) => {
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
||||
// Check boundary cli existence
|
||||
exists: () => Boolean(cliPath()),
|
||||
|
||||
// Initiate connection and return output
|
||||
connect: (target_id, token, host_id) => {
|
||||
const addr = origin.origin;
|
||||
@@ -33,13 +35,13 @@ module.exports = {
|
||||
`-target-id=${sanitized.target_id}`,
|
||||
`-token=${sanitized.token}`,
|
||||
`-addr=${addr}`,
|
||||
'-format=json',
|
||||
'--output-json-errors'
|
||||
'-format=json'
|
||||
];
|
||||
|
||||
if (host_id) command.push(`-host-id=${sanitized.host_id}`)
|
||||
return spawnAsyncJSONPromise(command);
|
||||
},
|
||||
|
||||
// Returns JSON-formatted version information from the CLI
|
||||
version: () => {
|
||||
const command = [ '-v' ];
|
||||
@@ -54,4 +56,5 @@ module.exports = {
|
||||
return { gitRevision, versionNumber, formatted };
|
||||
return rawOutput;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -52,8 +52,10 @@ module.exports = {
|
||||
childProcess.stderr.on('data', (data) => {
|
||||
errorStream += data.toString();
|
||||
const jsonData = jsonify(errorStream);
|
||||
const error = jsonData ? jsonData.error : undefined;
|
||||
if (jsonData) reject(new Error(error));
|
||||
if (jsonData) {
|
||||
const error = jsonData.api_error || jsonData.error;
|
||||
reject(new Error(error));
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user