Skip to content

Commit

Permalink
Present 'database error' dialog in more situations
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnonnenberg-signal committed Mar 13, 2019
1 parent 812f895 commit ca5132f
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions app/sql.js
Original file line number Diff line number Diff line change
Expand Up @@ -696,25 +696,25 @@ async function initialize({ configDir, key, messages }) {

filePath = path.join(dbDir, 'db.sqlite');

const sqlInstance = await openDatabase(filePath);
const promisified = promisify(sqlInstance);
try {
const sqlInstance = await openDatabase(filePath);
const promisified = promisify(sqlInstance);

// promisified.on('trace', async statement => {
// if (!db || statement.startsWith('--')) {
// console._log(statement);
// return;
// }
// const data = await db.get(`EXPLAIN QUERY PLAN ${statement}`);
// console._log(`EXPLAIN QUERY PLAN ${statement}\n`, data && data.detail);
// });
// promisified.on('trace', async statement => {
// if (!db || statement.startsWith('--')) {
// console._log(statement);
// return;
// }
// const data = await db.get(`EXPLAIN QUERY PLAN ${statement}`);
// console._log(`EXPLAIN QUERY PLAN ${statement}\n`, data && data.detail);
// });

await setupSQLCipher(promisified, { key });
await updateSchema(promisified);
await setupSQLCipher(promisified, { key });
await updateSchema(promisified);

db = promisified;
db = promisified;

// test database
try {
// test database
await getMessageCount();
} catch (error) {
console.log('Database startup error:', error.stack);
Expand Down

0 comments on commit ca5132f

Please sign in to comment.