Files
tweakcn/utils/try-catch.ts
T
Sahaj Jain f0c37392ac Feature/save (#41)
* setup drizzle with better-auth

* switch to turso

* chore: better auth migrations

* feat: add basic signin signup auth

* update form uis

* remove emailAndPassword

* loading state for auth btns

* add theme routes and save function

* migrate to actions

* feat: Add dashboard page to view saved themes

* hook up delete theme functionality

* minor improvements

* feat(auth): add AuthDialogWrapper and integrate with existing components

* setup post login action to open save modal after login

* refactor action bar

* refactor

* add ability to open theme by id

* Use URL param for themeId

* feat(editor): improve theme loading and add theme editing actions component

* feat(theme): implement theme editing functionality with routing updates

* refactor: move to try-catch

* remove unused files for auth and theme routes

* fix build errors

* modify copies

* add theme limit
2025-04-22 23:53:47 +05:30

9 lines
212 B
TypeScript

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;
}
}