From a8216bbd54f435a970508f27647f4e9bba131d98 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Sat, 3 Sep 2022 19:32:21 +0100 Subject: [PATCH] core: add error strings to SQLCipher encrypt/decrypt commands (#1014) --- src/Simplex/Chat/Archive.hs | 2 +- src/Simplex/Chat/Controller.hs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Simplex/Chat/Archive.hs b/src/Simplex/Chat/Archive.hs index d67a76520a..8811e3d155 100644 --- a/src/Simplex/Chat/Archive.hs +++ b/src/Simplex/Chat/Archive.hs @@ -130,7 +130,7 @@ export f key key' = do where withDB a err = liftIO (bracket (SQL.open $ T.pack f) SQL.close a) - `catch` \(e :: SomeException) -> liftIO (putStrLn $ "Database error: " <> show e) >> throwDBError err + `catch` \(e :: SomeException) -> liftIO (putStrLn $ "Database error: " <> show e) >> throwDBError (err $ show e) exportSQL = T.unlines $ keySQL key diff --git a/src/Simplex/Chat/Controller.hs b/src/Simplex/Chat/Controller.hs index 92340dfb8d..d6ab336825 100644 --- a/src/Simplex/Chat/Controller.hs +++ b/src/Simplex/Chat/Controller.hs @@ -434,8 +434,8 @@ instance ToJSON ChatErrorType where data DatabaseError = DBENotEncrypted | DBENoFile - | DBEExportFailed - | DBEOpenFailed + | DBEExportFailed {databaseError :: String} + | DBEOpenFailed {databaseError :: String} deriving (Show, Exception, Generic) instance ToJSON DatabaseError where