import {HTTPException} from 'hono/http-exception' // the shared "first row or 404" guard for single-row selects and // returning() writes export const firstOr404 = (rows: T[], code = 'not_found'): T => { const [row] = rows if (!row) throw new HTTPException(404, {message: code}) return row }