mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-07-02 03:38:22 +00:00
refactor: add tryCatch utility for error handling, update device-related components and types, and clean up unused code in payment actions
Some checks failed
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 13m55s
Some checks failed
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 13m55s
This commit is contained in:
8
utils/tryCatch.ts
Normal file
8
utils/tryCatch.ts
Normal file
@ -0,0 +1,8 @@
|
||||
export async function tryCatch<T, E = Error>(promise: T | Promise<T>) {
|
||||
try {
|
||||
const data = await promise;
|
||||
return [null, data] as const;
|
||||
} catch (error) {
|
||||
return [error as E, null] as const;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user