12 lines
260 B
TypeScript
12 lines
260 B
TypeScript
export const managePb404 = async <T>(
|
|
dbFunc: () => Promise<T>
|
|
): Promise<T | null> => {
|
|
try {
|
|
return await dbFunc()
|
|
} catch (err: any) {
|
|
if (err?.message === "The requested resource wasn't found.") {
|
|
return null
|
|
} else throw err
|
|
}
|
|
}
|