From 246d62b5788cf3679bf3a086bbbdf8ac6dc74bdb Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Wed, 1 Feb 2023 12:14:36 +0000 Subject: [PATCH] Merge pull request #11582 from overleaf/jpa-count-tokens-empty-result [access-token-encryptor] nicer log message for zero access token found GitOrigin-RevId: 2a28fdc71a1e063f091f55bc247d9dd26bbd0ee3 --- .../scripts/helpers/format-usage-stats.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libraries/access-token-encryptor/scripts/helpers/format-usage-stats.js b/libraries/access-token-encryptor/scripts/helpers/format-usage-stats.js index 02ed58743d..f32f5fb1c1 100644 --- a/libraries/access-token-encryptor/scripts/helpers/format-usage-stats.js +++ b/libraries/access-token-encryptor/scripts/helpers/format-usage-stats.js @@ -14,7 +14,14 @@ function formatTokenUsageStats(STATS) { .toFixed(2) .padStart(6) } - console.table(prettyStats) + + if (prettyStats.length === 0) { + console.warn('---') + console.warn('Found 0 access tokens.') + console.warn('---') + } else { + console.table(prettyStats) + } } module.exports = { formatTokenUsageStats }