1
0
Fork 0
mirror of synced 2024-10-06 04:54:52 +13:00

Catch 404s

This commit is contained in:
Adria Navarro 2023-07-18 10:36:01 +02:00
parent 5731b26079
commit 160d949423

View file

@ -35,8 +35,16 @@ export async function findByTable(tableId: string): Promise<ViewV2[]> {
export async function get(viewId: string): Promise<ViewV2 | undefined> {
const db = context.getAppDB()
const result = await db.get<ViewV2>(viewId)
return result
try {
const result = await db.get<ViewV2>(viewId)
return result
} catch (err: any) {
if (err.status === 404) {
return undefined
}
throw err
}
}
export async function save(view: ViewV2): Promise<ViewV2> {