SPB Git forge

spb/spinza

Public
8commits 1branches 0releases
1.6 MBsize
maindefault branch
16 days agolast push
TypeScript 97.6% SQL 1.4% JavaScript 0.5%
308 B · 8 lines typescript
Raw Blame History
1/** Extract the PostgreSQL error code from a raw pg error or a drizzle-wrapped one. */2export function pgCode(e: unknown): string | undefined {3  const err = e as { code?: string; cause?: { code?: string } } | undefined;4  return err?.code ?? err?.cause?.code;5}67export const PG_UNIQUE_VIOLATION = "23505";8