mirror of
https://git.unlock-music.dev/um/um-react.git
synced 2024-11-24 02:02:17 +00:00
8 lines
212 B
TypeScript
8 lines
212 B
TypeScript
export async function go<T = unknown, E = Error>(promise: Promise<T>): Promise<[T, null] | [null, E]> {
|
|
try {
|
|
return [await promise, null];
|
|
} catch (error: unknown) {
|
|
return [null, error as E];
|
|
}
|
|
}
|