Fix circular reference JSON serialization in telemetry logging (#4150)

This commit is contained in:
Bryan Morgan
2025-07-14 16:20:06 -04:00
committed by GitHub
parent 5008aea90d
commit ff3722a3a7
7 changed files with 294 additions and 17 deletions

View File

@@ -44,20 +44,9 @@ export function isProQuotaExceededError(error: unknown): boolean {
// - "Quota exceeded for quota metric 'Gemini 2.5-preview Pro Requests'"
// We use string methods instead of regex to avoid ReDoS vulnerabilities
const checkMessage = (message: string): boolean => {
console.log('[DEBUG] isProQuotaExceededError checking message:', message);
const result =
message.includes("Quota exceeded for quota metric 'Gemini") &&
message.includes("Pro Requests'");
console.log('[DEBUG] isProQuotaExceededError result:', result);
return result;
};
// Log the full error object to understand its structure
console.log(
'[DEBUG] isProQuotaExceededError - full error object:',
JSON.stringify(error, null, 2),
);
const checkMessage = (message: string): boolean =>
message.includes("Quota exceeded for quota metric 'Gemini") &&
message.includes("Pro Requests'");
if (typeof error === 'string') {
return checkMessage(error);