Add error 429: Too Many Requests
This commit is contained in:
parent
8dbe7bd680
commit
678b3edec6
2 changed files with 15 additions and 0 deletions
|
@ -84,6 +84,7 @@ module Servant.Server
|
|||
, err417
|
||||
, err418
|
||||
, err422
|
||||
, err429
|
||||
-- ** 5XX
|
||||
, err500
|
||||
, err501
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue