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 · ed7124be1f00e0dd196bd0586d2e839d04b0f72c
Menu

Theme