File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 1
- Add polysemy to spar; promote the SAMLUser CRUD interface to an effect (#1781)
1
+ Add polysemy to spar; promote the SAMLUser CRUD interface to an effect (#1781, #1786 )
Original file line number Diff line number Diff line change @@ -213,14 +213,18 @@ instance Member (Final IO) r => Catch.MonadCatch (Sem r) where
213
213
-- | Call a cassandra command in the 'Spar' monad. Catch all exceptions and re-throw them as 500 in
214
214
-- Handler.
215
215
wrapMonadClient :: Cas. Client a -> Spar r a
216
- wrapMonadClient action = do
216
+ wrapMonadClient action =
217
217
Spar $ do
218
218
ctx <- asks sparCtxCas
219
- lift (lift $ embedFinal @ IO $ runClient ctx action)
220
- `Catch.catch` (throwSpar . SparCassandraError . cs . show @ SomeException )
219
+ fromSpar $ wrapMonadClientSem $ embedFinal @ IO $ runClient ctx action
221
220
221
+ -- | Call a 'Sem' command in the 'Spar' monad. Catch all (IO) exceptions and
222
+ -- re-throw them as 500 in Handler.
222
223
wrapMonadClientSem :: Sem r a -> Spar r a
223
- wrapMonadClientSem action = liftSem $ action
224
+ wrapMonadClientSem action =
225
+ Spar $
226
+ (lift $ lift action)
227
+ `Catch.catch` (throwSpar . SparCassandraError . cs . show @ SomeException )
224
228
225
229
insertUser :: Member SAMLUser r => SAML. UserRef -> UserId -> Spar r ()
226
230
insertUser uref uid = wrapMonadClientSem $ SAMLUser. insert uref uid
You can’t perform that action at this time.
0 commit comments