Minor Changes
-
#16289
5d580c0Thanks @maxmalkin! - Adds a newgetDbError()helper exported fromastro:db. It walks the error.causechain and returns the underlyingLibsqlError, orundefinedif the error did not originate from libSQL. This is needed becausedrizzle-orm0.44+ wraps query errors in aDrizzleQueryErrorwhose.causeis the realLibsqlError.Upgrading
Code that reads
.codeor.messageafter catching a database error should migrate fromisDbError()togetDbError():// Before import { isDbError } from 'astro:db'; try { await db.insert(MyTable).values({ ... }); } catch (e) { if (isDbError(e)) { console.error(e.code, e.message); } } // After import { getDbError } from 'astro:db'; try { await db.insert(MyTable).values({ ... }); } catch (e) { const dbError = getDbError(e); if (dbError) { console.error(dbError.code, dbError.message); } }
isDbError()is still exported and still returnstruefor wrapped errors, but its return type is nowbooleaninstead of theerr is LibsqlErrortype predicate. Code that relied on the narrowing to access.codeor.messagedirectly will now produce a TypeScript error pointing you togetDbError().
Patch Changes
- #16289
5d580c0Thanks @maxmalkin! - Fixes a SQL injection vulnerability by updatingdrizzle-ormto^0.45.2, patching GHSA-gpj5-g38j-94v9 (CVE-2026-39356).