SPB Git

spb/spinza

Public
308 B · 8 lines typescript
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
Files · 3b4179a710ab1cd5f12ca7cfd253b81674f1521e
Menu

Theme