From 47df20b758532075547d9f4de23a96409ca07593 Mon Sep 17 00:00:00 2001 From: Jordan Millar Date: Mon, 18 Nov 2024 15:10:11 -0400 Subject: [PATCH] Add TxCmdCliScriptWitnessError to TxCmdError Add ScriptDecodeUnknownPlutusScriptVersion to ScriptDecodeError --- cardano-cli/cardano-cli.cabal | 1 + .../src/Cardano/CLI/Types/Errors/ScriptDecodeError.hs | 5 +++++ cardano-cli/src/Cardano/CLI/Types/Errors/TxCmdError.hs | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/cardano-cli/cardano-cli.cabal b/cardano-cli/cardano-cli.cabal index c920646133..d48ccdff66 100644 --- a/cardano-cli/cardano-cli.cabal +++ b/cardano-cli/cardano-cli.cabal @@ -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 diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/ScriptDecodeError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/ScriptDecodeError.hs index 2b4c37c9c6..7ba879c591 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/ScriptDecodeError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/ScriptDecodeError.hs @@ -7,6 +7,8 @@ where import Cardano.Api +import Data.Text + -- -- Handling decoding the variety of script languages and formats -- @@ -14,6 +16,7 @@ import Cardano.Api data ScriptDecodeError = ScriptDecodeTextEnvelopeError TextEnvelopeError | ScriptDecodeSimpleScriptError JsonDecodeError + | ScriptDecodeUnknownPlutusScriptVersion Text deriving Show instance Error ScriptDecodeError where @@ -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 diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/TxCmdError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/TxCmdError.hs index 19582fba41..87820b3b79 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/TxCmdError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/TxCmdError.hs @@ -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 @@ -50,6 +51,7 @@ data TxCmdError | TxCmdScriptWitnessError ScriptWitnessError | TxCmdProtocolParamsError ProtocolParamsError | TxCmdScriptFileError (FileError ScriptDecodeError) + | TxCmdCliScriptWitnessError !(FileError CliScriptWitnessError) | TxCmdKeyFileError (FileError InputDecodeError) | TxCmdReadTextViewFileError !(FileError TextEnvelopeError) | TxCmdReadWitnessSigningDataError !ReadWitnessSigningDataError @@ -105,6 +107,8 @@ renderTxCmdError = \case prettyError fileErr TxCmdScriptFileError fileErr -> prettyError fileErr + TxCmdCliScriptWitnessError cliScriptWitnessErr -> + prettyError cliScriptWitnessErr TxCmdKeyFileError fileErr -> prettyError fileErr TxCmdReadWitnessSigningDataError witSignDataErr ->