From 88436d8dee4f0186c537c01c0e3d996dce2a7f33 Mon Sep 17 00:00:00 2001 From: Shargon Date: Wed, 27 Nov 2019 11:56:49 +0100 Subject: [PATCH] Unify exceptions --- src/neo/Consensus/ConsensusMessage.cs | 2 +- src/neo/Network/P2P/Payloads/TransactionAttribute.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/neo/Consensus/ConsensusMessage.cs b/src/neo/Consensus/ConsensusMessage.cs index 856ccdc72b..53a28e7830 100644 --- a/src/neo/Consensus/ConsensusMessage.cs +++ b/src/neo/Consensus/ConsensusMessage.cs @@ -15,7 +15,7 @@ public abstract class ConsensusMessage : ISerializable protected ConsensusMessage(ConsensusMessageType type) { if (!Enum.IsDefined(typeof(ConsensusMessageType), type)) - throw new ArgumentOutOfRangeException(nameof(type)); + throw new FormatException(nameof(type)); this.Type = type; } diff --git a/src/neo/Network/P2P/Payloads/TransactionAttribute.cs b/src/neo/Network/P2P/Payloads/TransactionAttribute.cs index d4c31b2e49..fde51ee0f3 100644 --- a/src/neo/Network/P2P/Payloads/TransactionAttribute.cs +++ b/src/neo/Network/P2P/Payloads/TransactionAttribute.cs @@ -39,7 +39,7 @@ public static TransactionAttribute FromJson(JObject json) TransactionAttribute transactionAttribute = new TransactionAttribute(); transactionAttribute.Usage = (TransactionAttributeUsage)byte.Parse(json["usage"].AsString()); if (!Enum.IsDefined(typeof(TransactionAttributeUsage), transactionAttribute.Usage)) - throw new ArgumentException(); + throw new FormatException(); transactionAttribute.Data = Convert.FromBase64String(json["data"].AsString()); return transactionAttribute; }