Улучшение обработки ошибок

This commit is contained in:
Book Pauk
2022-10-16 00:40:06 +07:00
parent 58b1ed5638
commit 6bdfdebeaf

View File

@@ -146,7 +146,13 @@ class WebWorker {
await fs.remove(dbPath);
if (!await fs.pathExists(dbPath)) {
await this.createDb(dbPath);
try {
await this.createDb(dbPath);
} catch (e) {
//при ошибке создания БД удалим ее, чтобы не работать с поломанной базой при следующем запуске
await fs.remove(dbPath);
throw e;
}
utils.freeMemory();
}