mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-06-06 01:23:11 +00:00
core: catch IO exceptions in ExceptT (#2669)
* core: catch IO exceptions in ExceptT * catch IO exceptions for ACK * simplify, remove unnecessary changes * fix, update simplexmq * update simplexmq, enable all tests * fix * update simplexmq (fix finally) * update sha256map.nix
This commit is contained in:
committed by
GitHub
parent
e24564d7d6
commit
7a8db16791
@@ -34,6 +34,7 @@ import Simplex.Chat.Types
|
||||
import Simplex.Messaging.Agent.Protocol (AgentMsgId, ConnId, UserId)
|
||||
import Simplex.Messaging.Agent.Store.SQLite (firstRow, maybeFirstRow)
|
||||
import Simplex.Messaging.Parsers (dropPrefix, sumTypeJSON)
|
||||
import Simplex.Messaging.Util (allFinally)
|
||||
import UnliftIO.STM
|
||||
|
||||
-- These error type constructors must be added to mobile apps
|
||||
@@ -107,6 +108,14 @@ handleSQLError err e
|
||||
| DB.sqlError e == DB.ErrorConstraint = err
|
||||
| otherwise = SEInternalError $ show e
|
||||
|
||||
storeFinally :: ExceptT StoreError IO a -> ExceptT StoreError IO b -> ExceptT StoreError IO a
|
||||
storeFinally = allFinally mkStoreError
|
||||
{-# INLINE storeFinally #-}
|
||||
|
||||
mkStoreError :: E.SomeException -> StoreError
|
||||
mkStoreError = SEInternalError . show
|
||||
{-# INLINE mkStoreError #-}
|
||||
|
||||
fileInfoQuery :: Query
|
||||
fileInfoQuery =
|
||||
[sql|
|
||||
|
||||
Reference in New Issue
Block a user