(original: Error, dbPath: string)
| 48 | readonly dbPath: string; |
| 49 | |
| 50 | constructor(original: Error, dbPath: string) { |
| 51 | const codes = original as Error & { code?: unknown; errcode?: unknown; errstr?: unknown }; |
| 52 | const primary = typeof codes.errcode === 'number' ? codes.errcode & 0xff : -1; |
| 53 | const sqliteCode = SQLITE_CODE_NAMES[primary] ?? `SQLite error ${String(codes.errcode)}`; |
| 54 | const hint = HINTS[sqliteCode]; |
| 55 | super( |
| 56 | `Could not open the CodeGraph database at ${dbPath}: ${original.message} (${sqliteCode}).${hint ? ` ${hint}` : ''}`, |
| 57 | { cause: original } |
| 58 | ); |
| 59 | this.name = 'DatabaseOpenError'; |
| 60 | this.code = codes.code; |
| 61 | this.errcode = codes.errcode; |
| 62 | this.errstr = codes.errstr; |
| 63 | this.sqliteCode = sqliteCode; |
| 64 | this.dbPath = dbPath; |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | /** |
nothing calls this directly
no outgoing calls
no test coverage detected