Compare commits

...

3 commits

Author SHA1 Message Date
69bce58345
Improve exception handling of Zebra calls 2024-03-21 12:52:45 -05:00
adc7150b81
Merge branch 'dev040' into rav001 2024-03-20 14:34:11 -05:00
3af235377b
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>
2024-03-20 19:33:36 +00:00

View file

@ -23,7 +23,7 @@ import C.Zcash
, rustWrapperF4Jumble , rustWrapperF4Jumble
, rustWrapperF4UnJumble , rustWrapperF4UnJumble
) )
import Control.Exception (try) import Control.Exception (SomeException(..), try)
import Control.Monad.IO.Class import Control.Monad.IO.Class
import Data.Aeson import Data.Aeson
import qualified Data.ByteString as BS import qualified Data.ByteString as BS
@ -91,7 +91,7 @@ makeZebraCall host port m params = do
setRequestMethod "POST" defaultRequest setRequestMethod "POST" defaultRequest
r <- r <-
try $ httpJSON myRequest :: FromJSON a1 => try $ httpJSON myRequest :: FromJSON a1 =>
IO (Either HttpException (Response (RpcResponse a1))) IO (Either SomeException (Response (RpcResponse a1)))
case r of case r of
Left ex -> return $ Left $ show ex Left ex -> return $ Left $ show ex
Right res -> do Right res -> do