diff --git a/servant-server/src/Servant/Server.hs b/servant-server/src/Servant/Server.hs index 79d092b9..07d5fb91 100644 --- a/servant-server/src/Servant/Server.hs +++ b/servant-server/src/Servant/Server.hs @@ -84,6 +84,7 @@ module Servant.Server , err417 , err418 , err422 + , err429 -- ** 5XX , err500 , err501 diff --git a/servant-server/src/Servant/Server/Internal/ServerError.hs b/servant-server/src/Servant/Server/Internal/ServerError.hs index 5b5d56e2..650f6e10 100644 --- a/servant-server/src/Servant/Server/Internal/ServerError.hs +++ b/servant-server/src/Servant/Server/Internal/ServerError.hs @@ -392,6 +392,20 @@ err422 = ServerError { errHTTPCode = 422 , errHeaders = [] } +-- | 'err429' Too Many Requests +-- +-- Example: +-- +-- > failingHandler :: Handler () +-- > failingHandler = throwError $ err429 { errBody = "You have sent too many requests in a short period of time." } +-- +err429 :: ServerError +err429 = ServerError { errHTTPCode = 429 + , errReasonPhrase = "Too Many Requests" + , errBody = "" + , errHeaders = [] + } + -- | 'err500' Internal Server Error -- -- Example: