fix: load room availabiltity separately

This commit is contained in:
Joakim Jäderberg
2024-11-18 14:52:22 +01:00
parent e18a2fdc44
commit 260be9b641
4 changed files with 185 additions and 0 deletions

11
utils/safeTry.ts Normal file
View File

@@ -0,0 +1,11 @@
export type SafeTryResult<T> = Promise<
[T, undefined] | [undefined, Error | unknown]
>
export async function safeTry<T>(func: Promise<T>): SafeTryResult<T> {
try {
return [await func, undefined]
} catch (err) {
return [undefined, err]
}
}