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
|
, err417
|
||||||
, err418
|
, err418
|
||||||
, err422
|
, err422
|
||||||
|
, err429
|
||||||
-- ** 5XX
|
-- ** 5XX
|
||||||
, err500
|
, err500
|
||||||
, err501
|
, err501
|
||||||
|
|
|
@ -392,6 +392,20 @@ err422 = ServerError { errHTTPCode = 422
|
||||||
, errHeaders = []
|
, 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
|
-- | 'err500' Internal Server Error
|
||||||
--
|
--
|
||||||
-- Example:
|
-- Example:
|
||||||
|
|
Loading…
Reference in a new issue