File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -113,10 +113,10 @@ data Request = Request Text Args (Maybe Id)
113
113
114
114
instance A. FromJSON Request where
115
115
parseJSON (A. Object x) = (checkVersion =<< x .:? versionKey .!= jsonRpcVersion) *>
116
- (Request <$>
117
- x .: " method" <*>
118
- (parseParams =<< x .:? " params" .!= emptyObject) <*>
119
- parseId)
116
+ (Request <$>
117
+ x .: " method" <*>
118
+ (parseParams =<< x .:? " params" .!= emptyObject) <*>
119
+ parseId)
120
120
where parseParams (A. Object obj) = return $ Left obj
121
121
parseParams (A. Array ar) = return $ Right ar
122
122
parseParams _ = empty
@@ -170,11 +170,11 @@ instance A.ToJSON RpcError where
170
170
, (" data" .= ) <$> data' ]
171
171
172
172
instance A. FromJSON RpcError where
173
- parseJSON = A. withObject " JSON-RPC error object " $
174
- \ v -> RpcError <$ >
175
- v .: " code " <*>
176
- v .: " message " <*>
177
- v .:? " data "
173
+ parseJSON ( A. Object v) = RpcError <$>
174
+ v .: " code " <* >
175
+ v .: " message " <*>
176
+ v .:? " data "
177
+ parseJSON _ = empty
178
178
179
179
-- | Creates an 'RpcError' with the given error code and message.
180
180
-- According to the specification, server error codes should be
You can’t perform that action at this time.
0 commit comments