From 55157052846f374e4c417266e38d0a929fc9f7ff Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Feb 2026 03:56:33 +0000 Subject: [PATCH] fix(auth-utils): improve error message clarity for destroyed state Addresses Copilot AI comment on PR #79 about misleading error message. Problem: Error message said "Transaction capability destroyed - socket closed" but destroyed flag can be set in contexts other than socket closure, making the message potentially misleading or confusing. Examples when destroyed=true but socket may NOT be closed: 1. Manual cleanup during testing 2. Premature destroy() call due to bug 3. Destroy called but socket still open (edge case) Old message: "Transaction capability destroyed - socket closed" - Assumes socket is closed - Misleading if socket still open - Implies correlation that may not exist New message: "Transaction capability destroyed - cannot initiate new transactions" - States exact condition (destroyed=true) - Explains direct consequence (no new transactions) - No assumption about socket state - More accurate and helpful for debugging Impact: - Improved error clarity for developers debugging issues - No assumption about WHY destroyed is true - Focus on WHAT the error means (can't start transaction) - Better for logs and error tracking This is a low-severity improvement (message clarity only), but addresses valid feedback about potentially confusing error messaging. https://claude.ai/code/session_VMxqX --- src/Utils/auth-utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Utils/auth-utils.ts b/src/Utils/auth-utils.ts index 155ced79..204e16be 100644 --- a/src/Utils/auth-utils.ts +++ b/src/Utils/auth-utils.ts @@ -320,7 +320,7 @@ export const addTransactionCapability = ( // CRITICAL: Check destroyed flag INSIDE mutex to prevent race condition // This ensures atomic check-and-execute: if we acquire mutex, resources exist if (destroyed) { - throw new Error('Transaction capability destroyed - socket closed') + throw new Error('Transaction capability destroyed - cannot initiate new transactions') } const ctx: TransactionContext = {