@@ -49,7 +49,8 @@ import Web.HttpApiData
4949
5050data ServantError
5151 = FailureResponse
52− { responseStatus :: Status
52+ { failingRequest :: UrlReq
53+ , responseStatus :: Status
5354 , responseContentType :: MediaType
5455 , responseBody :: ByteString
5556 }
@@ -72,7 +73,7 @@ data ServantError
7273 deriving (Show, Typeable)
7374
7475instance Eq ServantError where
75− FailureResponse a b c == FailureResponse x y z =
76+ FailureResponse _ a b c == FailureResponse _ x y z =
7677 (a, b, c) == (x, y, z)
7778 DecodeFailure a b c == DecodeFailure x y z =
7879 (a, b, c) == (x, y, z)
@@ -86,6 +87,11 @@ instance Eq ServantError where
8687
8788instance Exception ServantError
8889
90+data UrlReq = UrlReq BaseUrl Req
91+
92+instance Show UrlReq where
93+ show (UrlReq url req) = showBaseUrl url ++ reqPath req ++ "?" ++ show (qs req)
94+
8995data Req = Req
9096 { reqPath :: BS.Builder
9197 , qs :: QueryText
@@ -252,7 +258,7 @@ performRequest reqMethod req = do
252258 Nothing -> throwError $ InvalidContentTypeHeader (cs t) body
253259 Just t' -> pure t'
254260 unless (status_code >= 200 && status_code < 300) $
255− throwError $ FailureResponse status ct body
261+ throwError $ FailureResponse (UrlReq reqHost req) status ct body
256262 return (status_code, body, ct, hdrs, response)
257263
258264performRequestCT :: MimeUnrender ct result => Proxy ct -> Method -> Req