Adapt response handling to Zebra (#40)
This PR allows for the Zebra behavior of not having a `result` field in the RPC response on error conditions. Reviewed-on: #40 Co-authored-by: Rene Vergara <rene@vergara.network> Co-committed-by: Rene Vergara <rene@vergara.network>
This commit is contained in:
parent
1af152dc31
commit
3af235377b
2 changed files with 2 additions and 1 deletions
|
@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Modified the `makeZebraCall` function to handle errors explicitly
|
- Modified the `makeZebraCall` function to handle errors explicitly
|
||||||
|
- Modified the RPC response to handle missing `result` field
|
||||||
|
|
||||||
## [0.5.0.1]
|
## [0.5.0.1]
|
||||||
|
|
||||||
|
|
|
@ -168,7 +168,7 @@ instance (FromJSON r) => FromJSON (RpcResponse r) where
|
||||||
withObject "RpcResponse" $ \obj -> do
|
withObject "RpcResponse" $ \obj -> do
|
||||||
e <- obj .:? "error"
|
e <- obj .:? "error"
|
||||||
i <- obj .: "id"
|
i <- obj .: "id"
|
||||||
r <- obj .: "result"
|
r <- obj .:? "result"
|
||||||
pure $ MakeRpcResponse e i r
|
pure $ MakeRpcResponse e i r
|
||||||
|
|
||||||
-- | A type to model the errors from the Zcash RPC
|
-- | A type to model the errors from the Zcash RPC
|
||||||
|
|
Loading…
Reference in a new issue