File tree Expand file tree Collapse file tree 4 files changed +18
-0
lines changed Expand file tree Collapse file tree 4 files changed +18
-0
lines changed Original file line number Diff line number Diff line change
1
+ synopsis: Fix build of examples/greet.hs. Add "429 Too Many Requests" error.
2
+ prs: #1591
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import Network.Wai.Handler.Warp
18
18
19
19
import Servant
20
20
import Servant.Server.Generic ()
21
+ import Servant.API.Generic ((:-) )
21
22
22
23
-- * Example
23
24
Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ module Servant.Server
84
84
, err417
85
85
, err418
86
86
, err422
87
+ , err429
87
88
-- ** 5XX
88
89
, err500
89
90
, err501
Original file line number Diff line number Diff line change @@ -392,6 +392,20 @@ err422 = ServerError { errHTTPCode = 422
392
392
, errHeaders = []
393
393
}
394
394
395
+ -- | 'err429' Too Many Requests
396
+ --
397
+ -- Example:
398
+ --
399
+ -- > failingHandler :: Handler ()
400
+ -- > failingHandler = throwError $ err429 { errBody = "You have sent too many requests in a short period of time." }
401
+ --
402
+ err429 :: ServerError
403
+ err429 = ServerError { errHTTPCode = 429
404
+ , errReasonPhrase = " Too Many Requests"
405
+ , errBody = " "
406
+ , errHeaders = []
407
+ }
408
+
395
409
-- | 'err500' Internal Server Error
396
410
--
397
411
-- Example:
You can’t perform that action at this time.
0 commit comments