diff --git a/src/Simplex/Chat/Library/Internal.hs b/src/Simplex/Chat/Library/Internal.hs index 22601ed656..9437556bb3 100644 --- a/src/Simplex/Chat/Library/Internal.hs +++ b/src/Simplex/Chat/Library/Internal.hs @@ -40,7 +40,7 @@ import Data.Foldable (foldr') import Data.Functor (($>)) import Data.Functor.Identity import Data.Int (Int64) -import Data.List (find, foldl', mapAccumL, partition) +import Data.List (find, foldl', isPrefixOf, mapAccumL, partition) import Data.List.NonEmpty (NonEmpty (..), (<|)) import qualified Data.List.NonEmpty as L import Data.Map.Strict (Map) @@ -921,8 +921,9 @@ acceptContactRequest nm user@User {userId} UserContactRequest {agentInvitationId dm <- encodeConnInfoPQ pqSup' chatV $ XInfo profileToSend sqSecured <- withAgent (\a -> acceptContact a nm (aUserId user) (aConnId conn) True invId dm pqSup' subMode) - `catchAllErrors` \case - ChatErrorAgent {agentError = CMD PROHIBITED _} -> throwCmdError "contact request already accepted" + `catchError` \case + ChatErrorAgent {agentError = CMD PROHIBITED errCxt} + | "SEInvitationNotFound" `isPrefixOf` errCxt -> throwCmdError "contact request already accepted" e -> throwError e pure (ct, conn, sqSecured)