mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-04-17 11:16:17 +00:00
move tryError to Simplex.Messaging.Util (#191)
This commit is contained in:
committed by
GitHub
parent
2ac903a2dd
commit
e07bedac0e
@@ -83,7 +83,7 @@ import qualified Simplex.Messaging.Crypto as C
|
||||
import Simplex.Messaging.Protocol (MsgBody, SenderPublicKey)
|
||||
import qualified Simplex.Messaging.Protocol as SMP
|
||||
import Simplex.Messaging.Transport (ATransport (..), TProxy, Transport (..), runTransportServer)
|
||||
import Simplex.Messaging.Util (bshow)
|
||||
import Simplex.Messaging.Util (bshow, tryError)
|
||||
import System.Random (randomR)
|
||||
import UnliftIO.Async (Async, async, race_)
|
||||
import qualified UnliftIO.Exception as E
|
||||
@@ -427,7 +427,6 @@ runSrvMsgDelivery c@AgentClient {subQ} srv = do
|
||||
notify connId $ SENT mId
|
||||
withStore $ \st -> updateSndMsgStatus st connId msgId SndMsgSent
|
||||
where
|
||||
tryError action = (Right <$> action) `catchError` (pure . Left)
|
||||
notify :: ConnId -> ACommand 'Agent -> m ()
|
||||
notify connId cmd = atomically $ writeTBQueue subQ ("", connId, cmd)
|
||||
|
||||
|
||||
@@ -50,3 +50,6 @@ liftError f = liftEitherError f . runExceptT
|
||||
|
||||
liftEitherError :: (MonadIO m, MonadError e' m) => (e -> e') -> IO (Either e a) -> m a
|
||||
liftEitherError f a = liftIOEither (first f <$> a)
|
||||
|
||||
tryError :: MonadError e m => m a -> m (Either e a)
|
||||
tryError action = (Right <$> action) `catchError` (pure . Left)
|
||||
|
||||
Reference in New Issue
Block a user