Catch 404s

This commit is contained in:
Adria Navarro 2023-07-18 10:36:01 +02:00
parent 5731b26079
commit 160d949423
1 changed files with 10 additions and 2 deletions

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()
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> {