From cd04430ec04d9e5ad8fd6de05f00152461c9900b Mon Sep 17 00:00:00 2001 From: "nkl199@yahoo.co.uk" Date: Tue, 14 Apr 2020 11:35:36 +0100 Subject: [PATCH] provide conditioning on input to table creation Signed-off-by: nkl199@yahoo.co.uk --- packages/caliper-core/lib/master/report/report.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/caliper-core/lib/master/report/report.js b/packages/caliper-core/lib/master/report/report.js index 472160abb..9774d8558 100644 --- a/packages/caliper-core/lib/master/report/report.js +++ b/packages/caliper-core/lib/master/report/report.js @@ -118,13 +118,17 @@ class Report { /** * print table - * @param {Map | Map[]} tableArray a table array containing performance information compatible with the npm table module + * @param {string[]} tableArray a table array containing performance information compatible with the npm table module */ printTable(tableArray) { // tableArray[0] = array of column titles // tableArray[1+] = array column values - let t = table.table(tableArray, {border: table.getBorderCharacters('ramac')}); - Logger.info('\n' + t); + if (tableArray.length > 0) { + let t = table.table(tableArray, {border: table.getBorderCharacters('ramac')}); + Logger.info('\n' + t); + } else { + Logger.error('No data within test result; implies error within configuration files'); + } } /**