Skip to content

Commit

Permalink
Error responses. [WIP]
Browse files Browse the repository at this point in the history
  • Loading branch information
fisx committed May 18, 2021
1 parent 1794cdd commit 53c48f8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions services/brig/src/Brig/API/Error.hs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ connError (ConnectBlacklistedUserKey k) = StdError $ foldKey (const blacklistedE
connError (ConnectInvalidEmail _ _) = StdError invalidEmail
connError ConnectInvalidPhone {} = StdError invalidPhone
connError ConnectSameBindingTeamUsers = StdError sameBindingTeamUsers
connError ConnectINeedLegalholdConsent = StdError iNeedLegalholdConsent
connError ConnectTheyNeedLegalholdConsent = StdError theyNeedLegalholdConsent

actError :: ActivationError -> Error
actError (UserKeyExists _) = StdError userKeyExists
Expand Down Expand Up @@ -473,6 +475,12 @@ propertyManagedByScim prop = Wai.Error status403 "managed-by-scim" $ "Updating \
sameBindingTeamUsers :: Wai.Error
sameBindingTeamUsers = Wai.Error status403 "same-binding-team-users" "Operation not allowed to binding team users."

iNeedLegalholdConsent :: Wai.Error
iNeedLegalholdConsent = Wai.Error status412 "i-need-lh-consent" "You cannot connect to a user with a legahold device, because you have not granted consent to being put under legalhold."

theyNeedLegalholdConsent :: Wai.Error
theyNeedLegalholdConsent = Wai.Error status412 "they-need-lh-consent" "You cannot connect to a user that has not granted consent to being put under legalhold, because you are under legalhold."

ownerDeletingSelf :: Wai.Error
ownerDeletingSelf =
Wai.Error
Expand Down
1 change: 1 addition & 0 deletions services/brig/src/Brig/API/Public.hs
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,7 @@ sitemap o = do
Doc.returns (Doc.ref Public.modelConnection)
Doc.response 200 "The connection exists." Doc.end
Doc.response 201 "The connection was created." Doc.end
Doc.response 412 "The connection cannot be created (eg., due to legalhold policy conflict)." Doc.end
Doc.errorResponse connectionLimitReached
Doc.errorResponse invalidUser
Doc.errorResponse (noIdentity 5)
Expand Down
4 changes: 4 additions & 0 deletions services/brig/src/Brig/API/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ data ConnectionError
ConnectInvalidPhone Phone
| -- | An attempt at creating a connection with another user from the same binding team.
ConnectSameBindingTeamUsers
| -- | I connect to somebody carrying a LH device, but I haven't granted consent.
ConnectINeedLegalholdConsent
| -- | I connect to somebody not having granted consent, but I'm carrying a LH device.
ConnectTheyNeedLegalholdConsent

data PasswordResetError
= PasswordResetInProgress (Maybe Timeout)
Expand Down
1 change: 1 addition & 0 deletions services/galley/src/Galley/API/Public.hs
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,7 @@ sitemap = do
returns (ref Public.modelEvent)
response 200 "Members added" end
response 204 "No change" end
response 412 "The user(s) cannot be added to the conversation (eg., due to legalhold policy conflict)."
errorResponse Error.convNotFound
errorResponse (Error.invalidOp "Conversation type does not allow adding members")
errorResponse Error.notConnected
Expand Down

0 comments on commit 53c48f8

Please sign in to comment.