diff options
author | 2024-12-11 13:23:53 +0100 | |
---|---|---|
committer | 2024-12-11 12:23:53 +0000 | |
commit | 618de283f57d19397246f69dd476611abd56cf13 (patch) | |
tree | 7781eaf8cb8c760402d2c2dae061696e6727b844 /packages/db/src/runtime/utils.ts | |
parent | 929ce2832560f9422a4a9ccb899e0f153d2a3471 (diff) | |
download | astro-618de283f57d19397246f69dd476611abd56cf13.tar.gz astro-618de283f57d19397246f69dd476611abd56cf13.tar.zst astro-618de283f57d19397246f69dd476611abd56cf13.zip |
🐛 Fix isDbError()-guard does not work (#12416)
* isDbError() does not work
Fixes #12400
* lint&format
* Update packages/db/src/runtime/virtual.ts
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
* use isDbError instead of "instanceof LibsqlError"
* unused imports
* mv isDbError to utils
* Update .changeset/breezy-radios-grab.md
---------
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
Diffstat (limited to 'packages/db/src/runtime/utils.ts')
-rw-r--r-- | packages/db/src/runtime/utils.ts | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/packages/db/src/runtime/utils.ts b/packages/db/src/runtime/utils.ts index 64301c39e..74201957f 100644 --- a/packages/db/src/runtime/utils.ts +++ b/packages/db/src/runtime/utils.ts @@ -42,6 +42,10 @@ export class DetailedLibsqlError extends LibsqlError { } } +export function isDbError(err: unknown): err is LibsqlError { + return err instanceof LibsqlError || (err instanceof Error && (err as any).libsqlError === true) +} + function slash(path: string) { const isExtendedLengthPath = path.startsWith('\\\\?\\'); |