diff --git a/src/Simplex/Messaging/Agent/Store/SQLite.hs b/src/Simplex/Messaging/Agent/Store/SQLite.hs index ff99f04b6..11b737893 100644 --- a/src/Simplex/Messaging/Agent/Store/SQLite.hs +++ b/src/Simplex/Messaging/Agent/Store/SQLite.hs @@ -78,12 +78,16 @@ data SQLiteStore = SQLiteStore createSQLiteStore :: FilePath -> Int -> [Migration] -> Bool -> IO SQLiteStore createSQLiteStore dbFilePath poolSize migrations yesToMigrations = do - let dbDir = takeDirectory dbFilePath - createDirectoryIfMissing False dbDir - st <- connectSQLiteStore dbFilePath poolSize - checkThreadsafe st - migrateSchema st migrations yesToMigrations - pure st + createStore + `E.catch` \(e :: E.SomeException) -> putStrLn ("exception: " <> show e) >> E.throwIO e + where + createStore = do + let dbDir = takeDirectory dbFilePath + createDirectoryIfMissing False dbDir + st <- connectSQLiteStore dbFilePath poolSize + checkThreadsafe st + migrateSchema st migrations yesToMigrations + pure st checkThreadsafe :: SQLiteStore -> IO () checkThreadsafe st = withConnection st $ \db -> do