packages feed

rest-client 0.5.0.3 → 0.5.0.4

raw patch · 3 files changed

+15/−5 lines, 3 files

Files

CHANGELOG.md view
@@ -1,7 +1,12 @@ # Changelog +#### 0.5.0.4++* Log some extra information when decoding JSON fails.+ #### 0.5.0.3 +* (revision) Allow `http-types 0.9.*` * Allow `rest-types 1.14.*`  #### 0.5.0.2
rest-client.cabal view
@@ -1,5 +1,5 @@ name:                rest-client-version:             0.5.0.3+version:             0.5.0.4 description:         Utility library for use in generated API client libraries. synopsis:            Utility library for use in generated API client libraries. maintainer:          code@silk.co@@ -31,7 +31,7 @@     , data-default == 0.5.*     , exceptions == 0.8.*     , http-conduit == 2.1.*-    , http-types >= 0.7 && < 0.9+    , http-types >= 0.7 && < 0.10     , hxt >= 9.2 && < 9.4     , hxt-pickle-utils == 0.1.*     , monad-control (>= 0.3.3.1 && < 0.4) || (>= 1.0.0.3 && < 1.1)
src/Rest/Client/Internal.hs view
@@ -33,7 +33,7 @@ import Control.Arrow import Control.Monad import Control.Monad.Cont-import Data.Aeson.Utils (FromJSON, ToJSON, decodeV, encode)+import Data.Aeson.Utils (FromJSON, ToJSON, eitherDecodeV, encode) import Data.Default (def) import Data.List import Data.Maybe@@ -115,8 +115,13 @@     _   -> fmap (Left . e) res  fromJSON :: FromJSON a => L.ByteString -> a-fromJSON v = (fromMaybe err . decodeV) v-  where err = error ("Error parsing JSON in api binding, this should not happen: " ++ L.toString v)+fromJSON v = (either err id . eitherDecodeV) v+  where+    err e = error (  "Error parsing JSON in api binding, this should not happen: got "+                  ++ L.toString v+                  ++ ", message: "+                  ++ show e+                  )  toJSON :: ToJSON a => a -> L.ByteString toJSON = encode