feat(chat): improve error handling and logging for premium quota exhaustion in chat operations

This commit is contained in:
Anish Sarkar 2026-04-29 22:01:28 +05:30
parent e6db050dfd
commit 222b27183f

View file

@ -1018,8 +1018,12 @@ export default function NewChatPage() {
} }
return; return;
} }
console.error("[NewChatPage] Chat error:", error);
const premiumQuotaAlertMessage = getPinnedPremiumQuotaErrorMessage(error); const premiumQuotaAlertMessage = getPinnedPremiumQuotaErrorMessage(error);
if (premiumQuotaAlertMessage) {
console.info("[NewChatPage] Premium quota exhausted:", error);
} else {
console.error("[NewChatPage] Chat error:", error);
}
// Track chat error // Track chat error
trackChatError( trackChatError(
@ -1329,8 +1333,12 @@ export default function NewChatPage() {
if (error instanceof Error && error.name === "AbortError") { if (error instanceof Error && error.name === "AbortError") {
return; return;
} }
console.error("[NewChatPage] Resume error:", error);
const premiumQuotaAlertMessage = getPinnedPremiumQuotaErrorMessage(error); const premiumQuotaAlertMessage = getPinnedPremiumQuotaErrorMessage(error);
if (premiumQuotaAlertMessage) {
console.info("[NewChatPage] Premium quota exhausted during resume:", error);
} else {
console.error("[NewChatPage] Resume error:", error);
}
if (premiumQuotaAlertMessage) { if (premiumQuotaAlertMessage) {
setPremiumAlertForThread({ setPremiumAlertForThread({
threadId: resumeThreadId, threadId: resumeThreadId,
@ -1357,6 +1365,7 @@ export default function NewChatPage() {
pendingInterrupt, pendingInterrupt,
messages, messages,
searchSpaceId, searchSpaceId,
currentUser?.id,
tokenUsageStore, tokenUsageStore,
toolsWithUI, toolsWithUI,
setPremiumAlertForThread, setPremiumAlertForThread,
@ -1683,8 +1692,12 @@ export default function NewChatPage() {
return; return;
} }
batcher.dispose(); batcher.dispose();
console.error("[NewChatPage] Regeneration error:", error);
const premiumQuotaAlertMessage = getPinnedPremiumQuotaErrorMessage(error); const premiumQuotaAlertMessage = getPinnedPremiumQuotaErrorMessage(error);
if (premiumQuotaAlertMessage) {
console.info("[NewChatPage] Premium quota exhausted during regeneration:", error);
} else {
console.error("[NewChatPage] Regeneration error:", error);
}
trackChatError( trackChatError(
searchSpaceId, searchSpaceId,
threadId, threadId,
@ -1717,6 +1730,7 @@ export default function NewChatPage() {
searchSpaceId, searchSpaceId,
messages, messages,
disabledTools, disabledTools,
currentUser?.id,
tokenUsageStore, tokenUsageStore,
toolsWithUI, toolsWithUI,
setPremiumAlertForThread, setPremiumAlertForThread,