From 5819dada32030f7fca6c2300134b637e28894f23 Mon Sep 17 00:00:00 2001 From: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com> Date: Wed, 20 Dec 2023 21:17:02 +0400 Subject: [PATCH] refactor --- src/Simplex/Chat/Store/Shared.hs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Simplex/Chat/Store/Shared.hs b/src/Simplex/Chat/Store/Shared.hs index b86c14ca5e..b2b95f05d6 100644 --- a/src/Simplex/Chat/Store/Shared.hs +++ b/src/Simplex/Chat/Store/Shared.hs @@ -389,8 +389,7 @@ createWithRandomBytes' size gVar create = tryCreate 3 tryCreate n = do id' <- liftIO $ encodedRandomBytes gVar size liftIO (E.try $ create id') >>= \case - Right (Right x) -> pure x - Right (Left e) -> throwError e + Right x -> liftEither x Left e | SQL.sqlError e == SQL.ErrorConstraint -> tryCreate (n - 1) | otherwise -> throwError . SEInternalError $ show e