You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Astro v4.6.2
Node v21.7.3
System macOS (arm64)
Package Manager bun
Output server
Adapter @astrojs/node
Integrations @astrojs/tailwind
astro:db
@astrojs/db/file-url
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, I would expect the LibsqlError details to be included in the AstroDbError. This way I can handle different sql error codes (e.g. unique constraint violations) as I want within my code:
Current result:
{
"type": "AstroUserError",
"hint": "See the Astro DB guide for query and push instructions: https://docs.astro.build/en/guides/astro-db/#query-your-database",
"name": "Astro DB Error",
"message": "UNIQUE constraint failed: Item.value"
}
Example class with added details from original error (utils.ts):
Example error building with cause as the original error (db-client.ts):
async function parseRemoteError(response: Response): Promise<AstroDbError> {
...
- return new AstroDbError(details, hint);+ return new AstroDbError(details, error, hint);
}
What's the expected result?
I would expect some sort of details about what type of error occurred on the AstroDbError (e.g. SQLITE_CONSTRAINT_UNIQUE):
{
+ "cause": { ... },
"type": "AstroUserError",
"hint": "See the Astro DB guide for query and push instructions: https://docs.astro.build/en/guides/astro-db/#query-your-database",
"name": "Astro DB Error",
"message": "UNIQUE constraint failed: Item.value"
}
timsexperiments
changed the title
Astro DB: Astro studio remote db not returning error codes.
astro:db: Astro studio remote db not returning error codes.
Apr 18, 2024
timsexperiments
changed the title
astro:db: Astro studio remote db not returning error codes.
astro:db: Astro remote db not returning error codes.
Apr 18, 2024
timsexperiments
changed the title
astro:db: Astro remote db not returning error codes.astro:db: Astro remote db not returning error codes.
Apr 18, 2024
timsexperiments
changed the title
astro:db: Astro remote db not returning error codes.astro:db: Astro remote db not returning SQL error info
Apr 18, 2024
Thanks for reporting this @timsexperiments! We've updated the production error object to a LibsqlError to match development. This will include the e.code property directly on the error, so there's no need for a nested cause for storage.
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, I would expect the
LibsqlError
details to be included in theAstroDbError
. This way I can handle different sql error codes (e.g. unique constraint violations) as I want within my code:Current result:
Example class with added details from original error (utils.ts):
Example error building with
cause
as the original error (db-client.ts
):What's the expected result?
I would expect some sort of details about what type of error occurred on the
AstroDbError
(e.g.SQLITE_CONSTRAINT_UNIQUE
):{ + "cause": { ... }, "type": "AstroUserError", "hint": "See the Astro DB guide for query and push instructions: https://docs.astro.build/en/guides/astro-db/#query-your-database", "name": "Astro DB Error", "message": "UNIQUE constraint failed: Item.value" }
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: