···6363export const QUOTA_EXCEEDED_MESSAGE =
6464 "You have exceeded your daily message quota (15). Please wait 24 hours before trying again.";
65656666+export const ERROR_MESSAGE =
6767+ "Sorry, I ran into an issue analyzing that post. Please try again.";
6868+6669export const UNAUTHORIZED_MESSAGE =
6770 "I can’t make sense of your noise just yet. You’ll need to be whitelisted before I can help.";
6871
+8-3
src/handlers/messages.ts
···174174 });
175175 }
176176 }
177177- } catch (error) {
177177+ } catch (error: any) {
178178 logger.error("Error in post handler:", error);
179179+ let errorMsg = c.ERROR_MESSAGE;
180180+181181+ if (error.error.code == 503) {
182182+ errorMsg =
183183+ "Sorry, the AI model is currently overloaded. Please try again later.";
184184+ }
179185180186 await conversation.sendMessage({
181181- text:
182182- "Sorry, I ran into an issue analyzing that post. Please try again.",
187187+ text: errorMsg,
183188 });
184189 }
185190}
+2-3
src/utils/conversation.ts
···88import { conversations, messages } from "../db/schema";
99import { and, eq } from "drizzle-orm";
1010import { env } from "../env";
1111-import { bot, MAX_GRAPHEMES } from "../core";
1111+import { bot, ERROR_MESSAGE, MAX_GRAPHEMES } from "../core";
1212import { parsePost, parsePostImages, traverseThread } from "./post";
13131414/*
···137137 };
138138 } catch (e) {
139139 convo.sendMessage({
140140- text:
141141- "Sorry, I ran into an issue analyzing that post. Please try again.",
140140+ text: ERROR_MESSAGE,
142141 });
143142144143 throw new Error("Failed to parse conversation");