Skip to content

Commit

Permalink
fix: changed "remote error" to "cause" in cli error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
emmacasolin committed Jun 6, 2022
1 parent fb2d68c commit d9b37a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/bin/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function outputFormatter(msg: OutputObject): string {
output += `${indent}host\t${currError.metadata.host}\n`;
output += `${indent}port\t${currError.metadata.port}\n`;
output += `${indent}timestamp\t${currError.timestamp}\n`;
output += `${indent}remote error: `;
output += `${indent}cause: `;
currError = currError.cause;
} else if (currError instanceof ErrorPolykey) {
output += `${currError.name}: ${currError.description}`;
Expand Down
9 changes: 5 additions & 4 deletions tests/bin/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ describe('bin/utils', () => {
),
},
);
// Error
// Human
expect(
binUtils.outputFormatter({ type: 'error', data: standardError }),
).toBe(`${standardError.name}: ${standardError.message}\n`);
Expand All @@ -141,7 +141,7 @@ describe('bin/utils', () => {
` host\t${host}\n` +
` port\t${port}\n` +
` timestamp\t${timestamp.toString()}\n` +
` remote error: ${remoteError.cause.name}: ${remoteError.cause.description} - ${remoteError.cause.message}\n` +
` cause: ${remoteError.cause.name}: ${remoteError.cause.description} - ${remoteError.cause.message}\n` +
` exitCode\t${pkError.exitCode}\n` +
` timestamp\t${timestamp.toString()}\n` +
` data\t${JSON.stringify(data)}\n`,
Expand All @@ -155,17 +155,18 @@ describe('bin/utils', () => {
` host\t${host}\n` +
` port\t${port}\n` +
` timestamp\t${timestamp.toString()}\n` +
` remote error: ${twoRemoteErrors.cause.name}: ${twoRemoteErrors.cause.description}\n` +
` cause: ${twoRemoteErrors.cause.name}: ${twoRemoteErrors.cause.description}\n` +
` command\t${twoRemoteErrors.cause.metadata.command}\n` +
` nodeId\t${nodesUtils.encodeNodeId(nodeId)}\n` +
` host\t${host}\n` +
` port\t${port}\n` +
` timestamp\t${timestamp.toString()}\n` +
` remote error: ${twoRemoteErrors.cause.cause.name}: ${twoRemoteErrors.cause.cause.description} - ${twoRemoteErrors.cause.cause.message}\n` +
` cause: ${twoRemoteErrors.cause.cause.name}: ${twoRemoteErrors.cause.cause.description} - ${twoRemoteErrors.cause.cause.message}\n` +
` exitCode\t${pkError.exitCode}\n` +
` timestamp\t${timestamp.toString()}\n` +
` cause: ${standardError.name}: ${standardError.message}\n`,
);
// JSON
expect(
binUtils.outputFormatter({ type: 'json', data: standardError }),
).toBe(
Expand Down

0 comments on commit d9b37a8

Please sign in to comment.