diff --git a/neo-cli/CLI/MainService.Contracts.cs b/neo-cli/CLI/MainService.Contracts.cs index 57454422c..aaa3546b3 100644 --- a/neo-cli/CLI/MainService.Contracts.cs +++ b/neo-cli/CLI/MainService.Contracts.cs @@ -30,9 +30,9 @@ private void OnDeployCommand(string filePath, string manifestPath = null) { tx = CurrentWallet.MakeTransaction(script); } - catch (InvalidOperationException) + catch (InvalidOperationException e) { - Console.WriteLine("Engine faulted."); + Console.WriteLine("Error: " + GetExceptionMessage(e)); return; } Console.WriteLine($"Script hash: {scriptHash.ToString()}"); @@ -68,9 +68,9 @@ private void OnInvokeCommand(UInt160 scriptHash, string operation, JArray contra { tx = CurrentWallet.MakeTransaction(tx.Script, signers.Length > 0 ? signers[0].Account : null, signers); } - catch (InvalidOperationException) + catch (InvalidOperationException e) { - Console.WriteLine("Error: insufficient balance."); + Console.WriteLine("Error: " + GetExceptionMessage(e)); return; } if (!ReadUserInput("Relay tx(no|yes)").IsYes()) diff --git a/neo-cli/CLI/MainService.NEP5.cs b/neo-cli/CLI/MainService.NEP5.cs index aa788f803..7230cac72 100644 --- a/neo-cli/CLI/MainService.NEP5.cs +++ b/neo-cli/CLI/MainService.NEP5.cs @@ -37,9 +37,9 @@ private void OnTransferCommand(UInt160 tokenHash, UInt160 to, decimal amount) } }, from: null); } - catch (InvalidOperationException) + catch (InvalidOperationException e) { - Console.WriteLine("Error: insufficient balance."); + Console.WriteLine("Error: " + GetExceptionMessage(e)); return; } if (!ReadUserInput("Relay tx(no|yes)").IsYes()) diff --git a/neo-cli/CLI/MainService.Network.cs b/neo-cli/CLI/MainService.Network.cs index a167f1424..4760f290e 100644 --- a/neo-cli/CLI/MainService.Network.cs +++ b/neo-cli/CLI/MainService.Network.cs @@ -146,7 +146,7 @@ private void OnRelayCommand(JObject jsonObjectToRelay) } catch (Exception e) { - Console.WriteLine($"One or more errors occurred:{Environment.NewLine}{e.Message}"); + Console.WriteLine("Error: " + GetExceptionMessage(e)); } } } diff --git a/neo-cli/CLI/MainService.Wallet.cs b/neo-cli/CLI/MainService.Wallet.cs index 5ebc7a728..c524b3338 100644 --- a/neo-cli/CLI/MainService.Wallet.cs +++ b/neo-cli/CLI/MainService.Wallet.cs @@ -378,7 +378,7 @@ private void OnSignCommand(JObject jsonObjectToSign) } catch (Exception e) { - Console.WriteLine($"One or more errors occurred:{Environment.NewLine}{e.Message}"); + Console.WriteLine("Error: " + GetExceptionMessage(e)); } } @@ -523,26 +523,20 @@ private void SignAndSendTx(Transaction tx) { context = new ContractParametersContext(tx); } - catch (InvalidOperationException ex) + catch (InvalidOperationException e) { - Console.WriteLine($"Error creating contract params: {ex}"); + Console.WriteLine($"Error creating contract params: " + GetExceptionMessage(e)); throw; } CurrentWallet.Sign(context); - string msg; if (context.Completed) { tx.Witnesses = context.GetWitnesses(); - NeoSystem.Blockchain.Tell(tx); - - msg = $"Signed and relayed transaction with hash={tx.Hash}"; - Console.WriteLine(msg); + Console.WriteLine($"Signed and relayed transaction with hash={tx.Hash}"); return; } - - msg = $"Failed sending transaction with hash={tx.Hash}"; - Console.WriteLine(msg); + Console.WriteLine($"Failed sending transaction with hash={tx.Hash}"); } } } diff --git a/neo-cli/CLI/MainService.cs b/neo-cli/CLI/MainService.cs index d528b4d3d..2dc8de110 100644 --- a/neo-cli/CLI/MainService.cs +++ b/neo-cli/CLI/MainService.cs @@ -578,7 +578,7 @@ static string GetExceptionMessage(Exception exception) if (exception.InnerException != null) { - return exception.InnerException.Message; + return GetExceptionMessage(exception.InnerException); } return exception.Message;