()
| 23 | } |
| 24 | |
| 25 | getConnection(): CustomSqliteEngine | null { |
| 26 | if (this.db) { |
| 27 | return this.db as any as CustomSqliteEngine; |
| 28 | } |
| 29 | |
| 30 | try { |
| 31 | this.db = new Database(this.dbPath, (err) => { |
| 32 | if (err) { |
| 33 | throw new Error(String(err)); |
| 34 | } |
| 35 | }); |
| 36 | |
| 37 | return this.db as any as CustomSqliteEngine; |
| 38 | } catch (err) { |
| 39 | reportError(`SQLite connection error: ${err}`); |
| 40 | return null; |
| 41 | } |
| 42 | |
| 43 | } |
| 44 | |
| 45 | async isOkay(): Promise<boolean> { |
| 46 | try { |
no test coverage detected