···63export const QUOTA_EXCEEDED_MESSAGE =
64 "You have exceeded your daily message quota (15). Please wait 24 hours before trying again.";
6500066export const UNAUTHORIZED_MESSAGE =
67 "I can’t make sense of your noise just yet. You’ll need to be whitelisted before I can help.";
68
···63export const QUOTA_EXCEEDED_MESSAGE =
64 "You have exceeded your daily message quota (15). Please wait 24 hours before trying again.";
6566+export const ERROR_MESSAGE =
67+ "Sorry, I ran into an issue analyzing that post. Please try again.";
68+69export const UNAUTHORIZED_MESSAGE =
70 "I can’t make sense of your noise just yet. You’ll need to be whitelisted before I can help.";
71
+8-3
src/handlers/messages.ts
···174 });
175 }
176 }
177- } catch (error) {
178 logger.error("Error in post handler:", error);
000000179180 await conversation.sendMessage({
181- text:
182- "Sorry, I ran into an issue analyzing that post. Please try again.",
183 });
184 }
185}
···174 });
175 }
176 }
177+ } catch (error: any) {
178 logger.error("Error in post handler:", error);
179+ let errorMsg = c.ERROR_MESSAGE;
180+181+ if (error.error.code == 503) {
182+ errorMsg =
183+ "Sorry, the AI model is currently overloaded. Please try again later.";
184+ }
185186 await conversation.sendMessage({
187+ text: errorMsg,
0188 });
189 }
190}
+2-3
src/utils/conversation.ts
···8import { conversations, messages } from "../db/schema";
9import { and, eq } from "drizzle-orm";
10import { env } from "../env";
11-import { bot, MAX_GRAPHEMES } from "../core";
12import { parsePost, parsePostImages, traverseThread } from "./post";
1314/*
···137 };
138 } catch (e) {
139 convo.sendMessage({
140- text:
141- "Sorry, I ran into an issue analyzing that post. Please try again.",
142 });
143144 throw new Error("Failed to parse conversation");
···8import { conversations, messages } from "../db/schema";
9import { and, eq } from "drizzle-orm";
10import { env } from "../env";
11+import { bot, ERROR_MESSAGE, MAX_GRAPHEMES } from "../core";
12import { parsePost, parsePostImages, traverseThread } from "./post";
1314/*
···137 };
138 } catch (e) {
139 convo.sendMessage({
140+ text: ERROR_MESSAGE,
0141 });
142143 throw new Error("Failed to parse conversation");