Improve response handling for Zebra RPC (#41)

This PR includes changes to handle differences between the `zebrad` and `zcashd` RPC.

Reviewed-on: #41
Co-authored-by: Rene Vergara <rene@vergara.network>
Co-committed-by: Rene Vergara <rene@vergara.network>
This commit is contained in:
Rene Vergara 2024-03-21 18:26:13 +00:00 committed by Vergara Technologies LLC
parent 3af235377b
commit d7752e9866
Signed by: Vergara Technologies LLC
GPG key ID: 99DB473BB4715618

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