Kadak

Errors

Handle KadakError codes with clear, user-safe responses.

Errors

Problem: raw Postgres errors are hard to map to product behavior.

Solution: KadakORM wraps errors into KadakError with stable codes and hints.

Handle errors once

import { KadakError } from '@shyk/kadak-orm'

try {
  await db.users.insert({ email: 'riya@example.com', name: 'Riya' })
} catch (err) {
  if (err instanceof KadakError) {
    console.error(err.code)
    console.error(err.hint)
  }
}

Common codes

  • VALIDATION_ERROR
  • UNIQUE_VIOLATION
  • NOT_NULL_VIOLATION
  • TABLE_NOT_FOUND
  • COLUMN_NOT_FOUND
  • CONNECTION_ERROR
  • QUERY_WARNING

Important: if you set warnings: 'strict', KadakORM throws QUERY_WARNING instead of logging.

On this page