Skip to content

Commit

Permalink
Explicit ToJSON instance for TxSubmitWebApiError
Browse files Browse the repository at this point in the history
  • Loading branch information
newhoggy committed Jan 12, 2024
1 parent b5438be commit b070859
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion cardano-submit-api/src/Cardano/TxSubmit/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,26 @@ data TxSubmitWebApiError

deriving instance Generic TxSubmitWebApiError

deriving anyclass instance ToJSON TxSubmitWebApiError
instance ToJSON TxSubmitWebApiError where
toJSON = \case
TxSubmitDecodeHex -> Aeson.object
[ "tag" .= String "TxSubmitDecodeHex"
]
TxSubmitEmpty -> Aeson.object
[ "tag" .= String "TxSubmitEmpty"
]
TxSubmitDecodeFail err -> Aeson.object
[ "tag" .= String "TxSubmitDecodeFail"
, "contents" .= toJSON err
]
TxSubmitBadTx err -> Aeson.object
[ "tag" .= String "TxSubmitBadTx"
, "contents" .= toJSON err
]
TxSubmitFail err -> Aeson.object
[ "tag" .= String "TxSubmitFail"
, "contents" .= toJSON err
]

newtype EnvSocketError = CliEnvVarLookup Text
deriving (Eq, Generic, Show)
Expand Down

0 comments on commit b070859

Please sign in to comment.