astro:db
: isDbError
functions differently with remote and local DB
#10809
Labels
- P3: minor bug
An edge case that only affects very specific usage (priority)
feat: errors
Related to error handling / messages (scope)
pkg: db
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
When running astro with the astro db plugin, the
isDbError
function is only working when running locally or using a file in the output. However, when running with a remote db the error is getting transformed to anAstroDbError
.This causes the
isDbError
function to returnfalse
:Having different expectations for local and remote databases means that code is not testable locally without actually connecting to a remote astro db. This means I need to write different code for local development and my production build.
What's the expected result?
I would expect one of the following:
import { db } from 'astro:db'
to return the same error no matter what environment (locally, file based, remote).AstroDbError
to also returntrue
when runningisDbError
. However theerr is LibsqlError
will befalse
. I would expect a single function that should work for both file based libsql queries and for astro remote db queries.Link to Minimal Reproducible Example
https://stackblitz.com/~/github.com/timsexperiments/astro-db-test
Participation
The text was updated successfully, but these errors were encountered: