From 160d949423f69b3bf44dff06c827430428ad7fec Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 18 Jul 2023 10:36:01 +0200 Subject: [PATCH] Catch 404s --- packages/server/src/sdk/app/views/index.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/server/src/sdk/app/views/index.ts b/packages/server/src/sdk/app/views/index.ts index a1cffeb2b5..60f886c2e2 100644 --- a/packages/server/src/sdk/app/views/index.ts +++ b/packages/server/src/sdk/app/views/index.ts @@ -35,8 +35,16 @@ export async function findByTable(tableId: string): Promise { export async function get(viewId: string): Promise { const db = context.getAppDB() - const result = await db.get(viewId) - return result + try { + const result = await db.get(viewId) + return result + } catch (err: any) { + if (err.status === 404) { + return undefined + } + + throw err + } } export async function save(view: ViewV2): Promise {