fix(claude-kiro): 修复社交认证方法下未检查profileArn的问题
当使用社交认证方法时,添加对profileArn的检查以避免潜在的错误 refactor(ui-manager): 改进console日志的错误处理 增强日志系统对复杂对象和错误的处理能力,避免字符串化时出现异常
This commit is contained in:
parent
96587f1ad0
commit
abe6a15b93
2 changed files with 24 additions and 4 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
|
|
|
|||
Loading…
Reference in a new issue