module Hydra.Contract.CommitError (
  errorCode,
  module Hydra.Contract.CommitError,
) where

import Hydra.Contract.Error (ToErrorCode (..), errorCode)
import Text.Show (Show)

data CommitError
  = STNotBurnedError
  | STIsMissingInTheOutput
  deriving stock (Int -> CommitError -> ShowS
[CommitError] -> ShowS
CommitError -> String
(Int -> CommitError -> ShowS)
-> (CommitError -> String)
-> ([CommitError] -> ShowS)
-> Show CommitError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CommitError -> ShowS
showsPrec :: Int -> CommitError -> ShowS
$cshow :: CommitError -> String
show :: CommitError -> String
$cshowList :: [CommitError] -> ShowS
showList :: [CommitError] -> ShowS
Show)

instance ToErrorCode CommitError where
  toErrorCode :: CommitError -> Text
toErrorCode = \case
    CommitError
STNotBurnedError -> Text
"C01"
    CommitError
STIsMissingInTheOutput -> Text
"C02"