From 6c6f49d93fd9281610450531410ebf3cc8470b86 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 12 Feb 2026 18:57:48 +0000 Subject: [PATCH] fix: apply PR review feedback corrections MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Addresses valid Copilot AI review comments from PR #152: 1. ✅ Add 'Failed to decrypt' check to console.error handler - Fixes inconsistency between console.log and console.error - Both handlers now detect all error types uniformly 2. ✅ Fix double space in emoji error messages - Changed '⚠️ Session Error' to '⚠️ Session Error' - Consistent with other emoji messages (one space) 3. ✅ Add type safety to args[1] concatenation - Changed (args[1] || '') to String(args[1] ?? '') - Prevents "[object Object]" when args[1] is an object https://claude.ai/code/session_01TvSrN9JmHZDdKMZDFWEcUS --- src/index.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index 12dd943f..48ee4303 100644 --- a/src/index.ts +++ b/src/index.ts @@ -30,7 +30,7 @@ console.log = function(...args: unknown[]) { msg.includes('Failed to decrypt') ) { // Extract error type - let errorType = '⚠️ Session Error' + let errorType = '⚠️ Session Error' if (msg.includes('Bad MAC')) errorType = '🔐 Bad MAC Error' else if (msg.includes('MessageCounterError') || msg.includes('Key used already')) errorType = '🔢 Counter Error' else if (msg.includes('Failed to decrypt')) errorType = '🔌 Decryption Failed' @@ -74,15 +74,17 @@ console.error = function(...args: unknown[]) { msg.includes('Session error') || msg.includes('Bad MAC') || msg.includes('MessageCounterError') || - msg.includes('Key used already') + msg.includes('Key used already') || + msg.includes('Failed to decrypt') ) { // Extract error type - let errorType = '⚠️ Session Error' + let errorType = '⚠️ Session Error' if (msg.includes('Bad MAC')) errorType = '🔐 Bad MAC Error' else if (msg.includes('MessageCounterError') || msg.includes('Key used already')) errorType = '🔢 Counter Error' + else if (msg.includes('Failed to decrypt')) errorType = '🔌 Decryption Failed' // Extract JID from stack trace or message - const jidMatch = (msg + (args[1] || '')).match(/(\d{10,}(?:_\d+\.\d+)?)/); + const jidMatch = (msg + String(args[1] ?? '')).match(/(\d{10,}(?:_\d+\.\d+)?)/); const jid = jidMatch ? jidMatch[1] : null const maskedJid = jid && jid.length > 8 ? `${jid.substring(0, 4)}****${jid.substring(jid.length - 4)}` : jid