From d9b37a8600fbf968fa3f4592cc7165c01209d2d3 Mon Sep 17 00:00:00 2001 From: Emma Casolin Date: Wed, 1 Jun 2022 15:26:27 +1000 Subject: [PATCH] fix: changed "remote error" to "cause" in cli error logging #323 --- src/bin/utils/utils.ts | 2 +- tests/bin/utils.test.ts | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/bin/utils/utils.ts b/src/bin/utils/utils.ts index 51b259dfb5..1345afb04c 100644 --- a/src/bin/utils/utils.ts +++ b/src/bin/utils/utils.ts @@ -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}`; diff --git a/tests/bin/utils.test.ts b/tests/bin/utils.test.ts index 80b9aa3bff..6a53667da4 100644 --- a/tests/bin/utils.test.ts +++ b/tests/bin/utils.test.ts @@ -124,7 +124,7 @@ describe('bin/utils', () => { ), }, ); - // Error + // Human expect( binUtils.outputFormatter({ type: 'error', data: standardError }), ).toBe(`${standardError.name}: ${standardError.message}\n`); @@ -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`, @@ -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(