This commit is contained in:
Daniel Casanueva 2023-02-15 07:07:28 +01:00 committed by GitHub
commit 43ee4c772a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 0 deletions

2
changelog.d/1591 Normal file
View File

@ -0,0 +1,2 @@
synopsis: Fix build of examples/greet.hs. Add "429 Too Many Requests" error.
prs: #1591

View File

@ -18,6 +18,7 @@ import Network.Wai.Handler.Warp
import Servant
import Servant.Server.Generic ()
import Servant.API.Generic ((:-))
-- * Example

View File

@ -84,6 +84,7 @@ module Servant.Server
, err417
, err418
, err422
, err429
-- ** 5XX
, err500
, err501

View File

@ -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: