From 2e6fc4a08ec9a40038471aab0015dfcd2e82aab3 Mon Sep 17 00:00:00 2001 From: Eyejoker Date: Mon, 23 Mar 2026 23:18:47 +0900 Subject: [PATCH] fix: add warn log for usage content build failures --- src/unified-dashboard.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/unified-dashboard.ts b/src/unified-dashboard.ts index 94f40b5..fbd5410 100644 --- a/src/unified-dashboard.ts +++ b/src/unified-dashboard.ts @@ -647,8 +647,10 @@ async function buildUsageContent(): Promise { // Emoji characters take 2 columns in monospace — count visual width const visualWidth = (s: string) => [...s].reduce((w, c) => w + (c.codePointAt(0)! > 0x7f ? 2 : 1), 0); - const maxNameWidth = Math.max(8, ...rows.map((r) => visualWidth(r.name))) + 1; - const padName = (s: string) => s + ' '.repeat(maxNameWidth - visualWidth(s)); + const maxNameWidth = + Math.max(8, ...rows.map((r) => visualWidth(r.name))) + 1; + const padName = (s: string) => + s + ' '.repeat(maxNameWidth - visualWidth(s)); lines.push('```'); lines.push(`${' '.repeat(maxNameWidth)}5-Hour 7-Day`); for (const row of rows) { @@ -735,8 +737,8 @@ async function refreshUsageCache(): Promise { usageUpdateInProgress = true; try { cachedUsageContent = await buildUsageContent(); - } catch { - /* keep previous cache */ + } catch (err) { + logger.warn({ err }, 'Failed to build usage content'); } finally { usageUpdateInProgress = false; }