@@ -73,11 +73,10 @@ import qualified SAML2.WebSSO as SAML
73
73
import Servant
74
74
import Servant.API.Generic
75
75
import Servant.Server.Generic (AsServerT )
76
- import Spar.App (Spar ( .. ), runSparInSem , throwSparSem )
76
+ import Spar.App (sparToServerErrorWithLogging , throwSparSem )
77
77
import Spar.Error
78
78
( SparCustomError (SparScimError ),
79
79
SparError ,
80
- sparToServerErrorWithLogging ,
81
80
)
82
81
import Spar.Scim.Auth
83
82
import Spar.Scim.User
@@ -87,6 +86,7 @@ import qualified Spar.Sem.IdP as IdPEffect
87
86
import Spar.Sem.Logger (Logger )
88
87
import Spar.Sem.Now (Now )
89
88
import Spar.Sem.Random (Random )
89
+ import Spar.Sem.Reporter (Reporter )
90
90
import Spar.Sem.SAMLUserStore (SAMLUserStore )
91
91
import Spar.Sem.ScimExternalIdStore (ScimExternalIdStore )
92
92
import Spar.Sem.ScimTokenStore (ScimTokenStore )
@@ -124,13 +124,14 @@ apiScim ::
124
124
ScimExternalIdStore ,
125
125
ScimUserTimesStore ,
126
126
ScimTokenStore ,
127
+ Reporter ,
127
128
IdPEffect. IdP ,
128
129
-- TODO(sandy): Only necessary for 'fromExceptionSem'. But can these errors even happen?
129
130
Final IO ,
130
131
SAMLUserStore
131
132
]
132
133
r =>
133
- ServerT APIScim (Spar r )
134
+ ServerT APIScim (Sem r )
134
135
apiScim =
135
136
hoistScim (toServant (server configuration))
136
137
:<|> apiScimToken
@@ -146,10 +147,10 @@ apiScim =
146
147
-- Let's hope that SCIM clients can handle non-SCIM-formatted errors
147
148
-- properly. See <https://github.com/haskell-servant/servant/issues/1022>
148
149
-- for why it's hard to catch impure exceptions.
149
- wrapScimErrors :: Spar r a -> Spar r a
150
- wrapScimErrors act = Spar $ do
150
+ wrapScimErrors :: Sem r a -> Sem r a
151
+ wrapScimErrors act = do
151
152
result :: Either SomeException (Either SparError a ) <-
152
- runError $ fromExceptionSem @ SomeException $ raise $ try @ SparError $ runSparInSem act
153
+ runError $ fromExceptionSem @ SomeException $ raise $ try @ SparError act
153
154
case result of
154
155
Left someException -> do
155
156
-- We caught an exception that's not a Spar exception at all. It is wrapped into
@@ -162,7 +163,7 @@ apiScim =
162
163
Right (Left sparError) -> do
163
164
-- We caught some other Spar exception. It is rendered and wrapped into a scim error
164
165
-- with the same status and message, and no scim error type.
165
- err :: ServerError <- undefined -- embedFinal @IO $ sparToServerErrorWithLogging undefined sparError
166
+ err :: ServerError <- sparToServerErrorWithLogging sparError
166
167
throw . SAML. CustomError . SparScimError $
167
168
Scim. ScimError
168
169
{ schemas = [Scim.Schema. Error20 ],
0 commit comments