{-# LANGUAGE LambdaCase #-}

module Cardano.CLI.Types.Errors.StakeCredentialError
  ( StakeCredentialError (..)
  )
where

import           Cardano.Api

import           Cardano.CLI.Types.Errors.ScriptDecodeError

data StakeCredentialError
  = StakeCredentialScriptDecodeError (FileError ScriptDecodeError)
  | StakeCredentialInputDecodeError (FileError InputDecodeError)
  deriving Int -> StakeCredentialError -> ShowS
[StakeCredentialError] -> ShowS
StakeCredentialError -> String
(Int -> StakeCredentialError -> ShowS)
-> (StakeCredentialError -> String)
-> ([StakeCredentialError] -> ShowS)
-> Show StakeCredentialError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> StakeCredentialError -> ShowS
showsPrec :: Int -> StakeCredentialError -> ShowS
$cshow :: StakeCredentialError -> String
show :: StakeCredentialError -> String
$cshowList :: [StakeCredentialError] -> ShowS
showList :: [StakeCredentialError] -> ShowS
Show

instance Error StakeCredentialError where
  prettyError :: forall ann. StakeCredentialError -> Doc ann
prettyError = \case
    StakeCredentialScriptDecodeError FileError ScriptDecodeError
e ->
      FileError ScriptDecodeError -> Doc ann
forall e ann. Error e => e -> Doc ann
forall ann. FileError ScriptDecodeError -> Doc ann
prettyError FileError ScriptDecodeError
e
    StakeCredentialInputDecodeError FileError InputDecodeError
e ->
      FileError InputDecodeError -> Doc ann
forall e ann. Error e => e -> Doc ann
forall ann. FileError InputDecodeError -> Doc ann
prettyError FileError InputDecodeError
e