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_ERRORUNIQUE_VIOLATIONNOT_NULL_VIOLATIONTABLE_NOT_FOUNDCOLUMN_NOT_FOUNDCONNECTION_ERRORQUERY_WARNING
Important: if you set
warnings: 'strict', KadakORM throwsQUERY_WARNINGinstead of logging.