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

Theme