aboutsummaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorKush Thaker <[email protected]>2024-07-23 19:19:36 +0530
committerKush Thaker <[email protected]>2024-07-23 19:19:36 +0530
commitd267a8d436dbd8d7e8f9fc16522ae7c1aa2bd6a4 (patch)
tree8f45b52bc1cefdc067c2330fb90c6f2eb3585532 /apps
parentfeat: Improve batch processing for vector metadata updates; Support long form... (diff)
downloadsupermemory-d267a8d436dbd8d7e8f9fc16522ae7c1aa2bd6a4.tar.xz
supermemory-d267a8d436dbd8d7e8f9fc16522ae7c1aa2bd6a4.zip
add try catch in api/add for better error handling
Diffstat (limited to 'apps')
-rw-r--r--apps/cf-ai-backend/src/index.ts5
1 files changed, 5 insertions, 0 deletions
diff --git a/apps/cf-ai-backend/src/index.ts b/apps/cf-ai-backend/src/index.ts
index 675039fa..cf6507c2 100644
--- a/apps/cf-ai-backend/src/index.ts
+++ b/apps/cf-ai-backend/src/index.ts
@@ -69,6 +69,7 @@ app.get("/api/health", (c) => {
});
app.post("/api/add", zValidator("json", vectorObj), async (c) => {
+ try{
const body = c.req.valid("json");
const { store } = await initQuery(c);
@@ -101,6 +102,10 @@ app.post("/api/add", zValidator("json", vectorObj), async (c) => {
});
return c.json({ status: "ok" });
+}catch(error){
+ console.error("Error processing request:", error);
+ return c.json({ status: "error", message: error.message }, 500);
+}
});
app.post(