X-Git-Url: http://www.average.org/gitweb/?p=pdns-pipe-nmc.git;a=blobdiff_plain;f=Data%2FJsonRpcClient.hs;h=6038695359b83a0131d96bf0219a13a976e043ce;hp=573e94df14529337d3d04b4cf44eb9a508a85978;hb=3d8f1365ed65330c2dca645df383eac050bae915;hpb=8234458b3e8d0f3a14ca178a34866aacf7772373 diff --git a/Data/JsonRpcClient.hs b/Data/JsonRpcClient.hs index 573e94d..6038695 100644 --- a/Data/JsonRpcClient.hs +++ b/Data/JsonRpcClient.hs @@ -46,9 +46,9 @@ data JsonRpcError = JsonRpcError { jrpcErrCode :: Int } deriving (Show) instance FromJSON JsonRpcError where parseJSON (Object o) = JsonRpcError - <$> o .: "code" - <*> o .: "error" - <*> o .: "data" + <$> o .: "code" + <*> o .: "message" + <*> o .:? "data" parseJSON x = return $ JsonRpcError (-32600) "Unparseable error object" @@ -60,9 +60,9 @@ data JsonRpcResponse = JsonRpcResponse { jrpcRspResult :: Maybe Value } deriving (Show) instance FromJSON JsonRpcResponse where parseJSON (Object o) = JsonRpcResponse - <$> o .: "result" - <*> o .: "error" - <*> o .: "id" + <$> o .:? "result" + <*> o .: "error" + <*> o .: "id" parseJSON x = return $ JsonRpcResponse Nothing (JsonRpcError