-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In SCIM handlers, format (almost) all errors using SCIM error schema #575
Conversation
17edeb1
to
4b7f645
Compare
829f41c
to
553bc77
Compare
services/spar/src/Spar/Scim.hs
Outdated
-- SCIM.serverError and rethrown. | ||
Right (Left sparError) -> | ||
Left . SAML.CustomServant . Scim.scimToServantErr $ | ||
Scim.serverError (cs (errBody (sparToServantErr sparError))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just Left sparError
? Then it will be converted later on in sparToServantErr
like before.
Come to think of it, I would like to add a constructor ... | SparScimError ScimError
to SparCustomError
, change toSpar
as follows, and leave the conversion to ServantErr
to the Error
module:
toSpar = Scim.fromScimHandler (throwError . SparScimError)
We will still have this weird construct where the saml library wraps all errors, even those that have nothing to do with saml, but it keeps the errors in the app logic more strongly typed, and moves the burdon of rendering them more cleanly to the Error
module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(do you want me to do that?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay with the constructor, as long as the /scim/v2 branch uses the SCIM format for all errors (as the spec requires). We also should take care to not wrap SCIM errors twice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed. let me know if you want me to do any of this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will get around to it at some point but I'm not sure when.
af02e2a
to
e56aea9
Compare
e56aea9
to
d407b2f
Compare
I'll return to this PR once #698 is merged. |
dc0d057
to
e0bed1e
Compare
76061e9
to
31cd368
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Can go in as is if you don't like my changes.
-- properly. See <https://github.com/haskell-servant/servant/issues/1022> | ||
-- for why it's hard to catch impure exceptions. | ||
wrapScimErrors :: Spar a -> Spar a | ||
wrapScimErrors = over _Spar $ \act -> \env -> do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrapScimErrors = over _Spar $ \act -> \env -> do | |
wrapScimErrors = over _Spar $ \act env -> do |
Co-Authored-By: neongreen <yom@artyom.me>
Co-Authored-By: neongreen <yom@artyom.me>
sorry about the glitch! :/ |
No description provided.