File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,9 @@ doUnauthRequest cd = submitRequest cd Nothing
102102-- raises 'RateLimitException' with the fields populated from the
103103-- response headers where possible.
104104--
105+ -- If the request fails due to a 413 (too-large) response, this raises
106+ -- 'RequestTooLargeException'.
107+ --
105108-- If the response status is 2XX, the response is returned.
106109--
107110-- If the response status is anything else, its body is assumed to be
@@ -165,6 +168,9 @@ submitRequest cd mToken method uri payload = do
165168
166169 rsp <- hoistE (left ConnectionException rawResponse)
167170 case HTTP. rspCode rsp of
171+ (4 , 1 , 3 ) ->
172+ throwIO RequestTooLargeException
173+
168174 (4 , 2 , 9 ) -> do
169175 -- Extract rate limit information if possible
170176 let headers = HTTP. getHeaders rsp
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ module Network.Mattermost.Exceptions
1313, ConnectionException (.. )
1414, MattermostServerError (.. )
1515, RateLimitException (.. )
16+ , RequestTooLargeException (.. )
1617) where
1718
1819import qualified Data.Aeson as A
@@ -86,6 +87,13 @@ data MattermostServerError = MattermostServerError T.Text
8687
8788instance Exception MattermostServerError
8889
90+ -- | An exception raised when a request's size was too large for the
91+ -- server and was thus rejected.
92+ data RequestTooLargeException = RequestTooLargeException
93+ deriving (Eq , Show )
94+
95+ instance Exception RequestTooLargeException
96+
8997-- | An exception raised when a request could not be completed due to a
9098-- request rate limit violation.
9199data RateLimitException =
You can’t perform that action at this time.
0 commit comments