(err: unknown, dbPath: string)
| 73 | * explanation included. |
| 74 | */ |
| 75 | export function toDatabaseOpenError(err: unknown, dbPath: string): unknown { |
| 76 | if (err instanceof DatabaseOpenError || err instanceof WslSharedIndexError || err instanceof NodeSqliteUnavailableError) { |
| 77 | return err; |
| 78 | } |
| 79 | const shared = toWslSharedIndexError(err, dbPath); |
| 80 | if (shared) return shared; |
| 81 | if (err instanceof Error && typeof (err as { errcode?: unknown }).errcode === 'number') { |
| 82 | return new DatabaseOpenError(err, dbPath); |
| 83 | } |
| 84 | return err; |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * A project's index exists but could not be opened: what a caller reports as |
no test coverage detected