Catch 404s
This commit is contained in:
parent
5731b26079
commit
160d949423
|
@ -35,8 +35,16 @@ export async function findByTable(tableId: string): Promise<ViewV2[]> {
|
||||||
|
|
||||||
export async function get(viewId: string): Promise<ViewV2 | undefined> {
|
export async function get(viewId: string): Promise<ViewV2 | undefined> {
|
||||||
const db = context.getAppDB()
|
const db = context.getAppDB()
|
||||||
|
try {
|
||||||
const result = await db.get<ViewV2>(viewId)
|
const result = await db.get<ViewV2>(viewId)
|
||||||
return result
|
return result
|
||||||
|
} catch (err: any) {
|
||||||
|
if (err.status === 404) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
throw err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function save(view: ViewV2): Promise<ViewV2> {
|
export async function save(view: ViewV2): Promise<ViewV2> {
|
||||||
|
|
Loading…
Reference in New Issue