diff options
| author | Kush Thaker <[email protected]> | 2024-07-23 19:19:36 +0530 |
|---|---|---|
| committer | Kush Thaker <[email protected]> | 2024-07-23 19:19:36 +0530 |
| commit | d267a8d436dbd8d7e8f9fc16522ae7c1aa2bd6a4 (patch) | |
| tree | 8f45b52bc1cefdc067c2330fb90c6f2eb3585532 | |
| parent | feat: Improve batch processing for vector metadata updates; Support long form... (diff) | |
| download | supermemory-d267a8d436dbd8d7e8f9fc16522ae7c1aa2bd6a4.tar.xz supermemory-d267a8d436dbd8d7e8f9fc16522ae7c1aa2bd6a4.zip | |
add try catch in api/add for better error handling
| -rw-r--r-- | apps/cf-ai-backend/src/index.ts | 5 |
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( |