Skip to content

Commit

Permalink
Add TxCmdCliScriptWitnessError to TxCmdError
Browse files Browse the repository at this point in the history
Add ScriptDecodeUnknownPlutusScriptVersion to ScriptDecodeError
  • Loading branch information
Jimbo4350 committed Nov 21, 2024
1 parent e567a54 commit 34281ab
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions cardano-cli/cardano-cli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ library
Cardano.CLI.Options.Key
Cardano.CLI.Options.Node
Cardano.CLI.Options.Ping
Cardano.CLI.Plutus.Minting
Cardano.CLI.Orphans
Cardano.CLI.Parser
Cardano.CLI.Read
Expand Down
5 changes: 5 additions & 0 deletions cardano-cli/src/Cardano/CLI/Types/Errors/ScriptDecodeError.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ where

import Cardano.Api

import Data.Text

--
-- Handling decoding the variety of script languages and formats
--

data ScriptDecodeError
= ScriptDecodeTextEnvelopeError TextEnvelopeError
| ScriptDecodeSimpleScriptError JsonDecodeError
| ScriptDecodeUnknownPlutusScriptVersion Text
deriving Show

instance Error ScriptDecodeError where
Expand All @@ -22,3 +25,5 @@ instance Error ScriptDecodeError where
"Error decoding script: " <> prettyError err
ScriptDecodeSimpleScriptError err ->
"Syntax error in script: " <> prettyError err
ScriptDecodeUnknownPlutusScriptVersion version ->
"Unknown Plutus script version: " <> pshow version
4 changes: 4 additions & 0 deletions cardano-cli/src/Cardano/CLI/Types/Errors/TxCmdError.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import Cardano.Api.Consensus (EraMismatch (..))
import qualified Cardano.Api.Ledger as L
import Cardano.Api.Shelley

import Cardano.CLI.Plutus.Minting
import Cardano.CLI.Read
import Cardano.CLI.Types.Common
import Cardano.CLI.Types.Errors.BootstrapWitnessError
Expand Down Expand Up @@ -50,6 +51,7 @@ data TxCmdError
| TxCmdScriptWitnessError ScriptWitnessError
| TxCmdProtocolParamsError ProtocolParamsError
| TxCmdScriptFileError (FileError ScriptDecodeError)
| TxCmdCliScriptWitnessError !(FileError CliScriptWitnessError)
| TxCmdKeyFileError (FileError InputDecodeError)
| TxCmdReadTextViewFileError !(FileError TextEnvelopeError)
| TxCmdReadWitnessSigningDataError !ReadWitnessSigningDataError
Expand Down Expand Up @@ -105,6 +107,8 @@ renderTxCmdError = \case
prettyError fileErr
TxCmdScriptFileError fileErr ->
prettyError fileErr
TxCmdCliScriptWitnessError cliScriptWitnessErr ->
prettyError cliScriptWitnessErr
TxCmdKeyFileError fileErr ->
prettyError fileErr
TxCmdReadWitnessSigningDataError witSignDataErr ->
Expand Down

0 comments on commit 34281ab

Please sign in to comment.