{-# LANGUAGE LambdaCase #-}
module Cardano.CLI.Types.Errors.ScriptDecodeError
( ScriptDecodeError (..)
)
where
import Cardano.Api
import Data.Text
data ScriptDecodeError
= ScriptDecodeTextEnvelopeError TextEnvelopeError
| ScriptDecodeSimpleScriptError JsonDecodeError
| ScriptDecodeUnknownPlutusScriptVersion Text
deriving Int -> ScriptDecodeError -> ShowS
[ScriptDecodeError] -> ShowS
ScriptDecodeError -> String
(Int -> ScriptDecodeError -> ShowS)
-> (ScriptDecodeError -> String)
-> ([ScriptDecodeError] -> ShowS)
-> Show ScriptDecodeError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ScriptDecodeError -> ShowS
showsPrec :: Int -> ScriptDecodeError -> ShowS
$cshow :: ScriptDecodeError -> String
show :: ScriptDecodeError -> String
$cshowList :: [ScriptDecodeError] -> ShowS
showList :: [ScriptDecodeError] -> ShowS
Show
instance Error ScriptDecodeError where
prettyError :: forall ann. ScriptDecodeError -> Doc ann
prettyError = \case
ScriptDecodeTextEnvelopeError TextEnvelopeError
err ->
Doc ann
"Error decoding script:" Doc ann -> Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann -> Doc ann
<+> TextEnvelopeError -> Doc ann
forall e ann. Error e => e -> Doc ann
forall ann. TextEnvelopeError -> Doc ann
prettyError TextEnvelopeError
err
ScriptDecodeSimpleScriptError JsonDecodeError
err ->
Doc ann
"Syntax error in script:" Doc ann -> Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann -> Doc ann
<+> JsonDecodeError -> Doc ann
forall e ann. Error e => e -> Doc ann
forall ann. JsonDecodeError -> Doc ann
prettyError JsonDecodeError
err
ScriptDecodeUnknownPlutusScriptVersion Text
version ->
Doc ann
"Unknown Plutus script version:" Doc ann -> Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann -> Doc ann
<+> Text -> Doc ann
forall a ann. Show a => a -> Doc ann
pshow Text
version