diff --git a/src/claude/claude-kiro.js b/src/claude/claude-kiro.js index ad1bd8e..1fb5070 100644 --- a/src/claude/claude-kiro.js +++ b/src/claude/claude-kiro.js @@ -1784,7 +1784,7 @@ async initializeAuth(forceRefresh = false) { origin: KIRO_CONSTANTS.ORIGIN_AI_EDITOR, resourceType: resourceType }); - if (this.authMethod === KIRO_CONSTANTS.AUTH_METHOD_SOCIAL) { + if (this.authMethod === KIRO_CONSTANTS.AUTH_METHOD_SOCIAL && this.profileArn) { params.append('profileArn', this.profileArn); } const fullUrl = `${usageLimitsUrl}?${params.toString()}`; @@ -1828,7 +1828,7 @@ async initializeAuth(forceRefresh = false) { throw refreshError; } } - console.error('[Kiro] Failed to fetch usage limits:', error.message); + console.error('[Kiro] Failed to fetch usage limits:', error.message, error); throw error; } } diff --git a/src/ui-manager.js b/src/ui-manager.js index 87a98cd..3e0f1ef 100644 --- a/src/ui-manager.js +++ b/src/ui-manager.js @@ -1881,7 +1881,17 @@ export function initializeUIManagement() { const originalLog = console.log; console.log = function(...args) { originalLog.apply(console, args); - const message = args.map(arg => typeof arg === 'string' ? arg : JSON.stringify(arg)).join(' '); + const message = args.map(arg => { + if (typeof arg === 'string') return arg; + try { + return JSON.stringify(arg); + } catch (e) { + if (arg instanceof Error) { + return `[Error: ${arg.message}] ${arg.stack || ''}`; + } + return `[Object: ${Object.prototype.toString.call(arg)}] (Circular or too complex to stringify)`; + } + }).join(' '); const logEntry = { timestamp: new Date().toISOString(), level: 'info', @@ -1898,7 +1908,17 @@ export function initializeUIManagement() { const originalError = console.error; console.error = function(...args) { originalError.apply(console, args); - const message = args.map(arg => typeof arg === 'string' ? arg : JSON.stringify(arg)).join(' '); + const message = args.map(arg => { + if (typeof arg === 'string') return arg; + try { + return JSON.stringify(arg); + } catch (e) { + if (arg instanceof Error) { + return `[Error: ${arg.message}] ${arg.stack || ''}`; + } + return `[Object: ${Object.prototype.toString.call(arg)}] (Circular or too complex to stringify)`; + } + }).join(' '); const logEntry = { timestamp: new Date().toISOString(), level: 'error',