import { type ApiError } from '@/lib/types' export async function handleError(cb: () => Promise) { try { const data = await cb() return { data, error: null } } catch (e) { return { data: null, error: e as ApiError } } }