Skip to content

Commit

Permalink
Add a manual Eq QueryException instance
Browse files Browse the repository at this point in the history
This is to work around a missing Eq AcquiringFailure, see IntersectMBO/cardano-node#4683
  • Loading branch information
ch1bo committed Nov 30, 2022
1 parent 7b61d2c commit be95c75
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion hydra-node/src/Hydra/Chain/CardanoClient.hs
Expand Up @@ -20,7 +20,16 @@ type NodeSocket = FilePath
data QueryException
= QueryAcquireException AcquiringFailure
| QueryEraMismatchException EraMismatch
deriving (Eq, Show)
deriving (Show)

instance Eq QueryException where
a == b = case (a, b) of
(QueryAcquireException af1, QueryAcquireException af2) -> case (af1, af2) of
(AFPointTooOld, AFPointTooOld) -> True
(AFPointNotOnChain, AFPointNotOnChain) -> True
_ -> False
(QueryEraMismatchException em1, QueryEraMismatchException em2) -> em1 == em2
_ -> False

instance Exception QueryException

Expand Down

0 comments on commit be95c75

Please sign in to comment.