Skip to content

Commit 7b36a5a

Browse files
committed
Fix / update UsingRawBytesHex class/instances
This should be rather taken from upstream. Created two PRs to avoid workarounds: IntersectMBO/cardano-node#5085 and IntersectMBO/cardano-node#5086
1 parent 47a994e commit 7b36a5a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

hydra-cardano-api/src/Hydra/Cardano/Api/UsingRawBytesHex.hs

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
-- | Shamelessly stolen from cardan-api 'Cardano.Api.SerialiseUsing' module.
22
--
33
-- With some minor modifications of also using encodeUtf8 in 'IsString' instance.
4+
--
5+
-- XXX: Expose / contribute upstream
46
module Hydra.Cardano.Api.UsingRawBytesHex where
57

68
import Hydra.Cardano.Api.Prelude
@@ -52,8 +54,10 @@ deserialiseFromRawBytesBase16 ::
5254
deserialiseFromRawBytesBase16 str =
5355
case Base16.decode str of
5456
Right raw -> case deserialiseFromRawBytes ttoken raw of
55-
Just x -> Right (UsingRawBytesHex x)
56-
Nothing -> Left ("cannot deserialise " ++ show str)
57+
Right x -> Right (UsingRawBytesHex x)
58+
-- XXX: cannot user inner value because SerialiseAsRawBytesError data
59+
-- constructor not exposed
60+
Left e -> Left ("cannot deserialise " ++ show str ++ ". The error was: " <> show e)
5761
Left msg -> Left ("invalid hex " ++ show str ++ ", " ++ msg)
5862
where
5963
ttoken = proxyToAsType (Proxy :: Proxy a)

0 commit comments

Comments
 (0)