using System; using Nethereum.ABI.FunctionEncoding.Attributes; using Nethereum.ABI.Model; namespace Nethereum.Contracts { public class Error : ErrorBase where TError : class, IErrorDTO, new() { public Error() : base(typeof(TError)) { } public TError DecodeExceptionEncodedData(string data) { if (ErrorABI.IsExceptionEncodedDataForError(data)) { return data.DecodeExceptionEncodedData(); } return null; } } public class Error: ErrorBase { public Error(ErrorABI errorABI):base(errorABI) { } public Error(Type errorTypeAbi):base(errorTypeAbi) { } public bool IsErrorForErrorType() { return ErrorABI.IsErrorABIForErrorType(); } public TError DecodeExceptionEncodedData(string data) where TError : class, IErrorDTO, new() { if (IsErrorForErrorType()) { if (ErrorABI.IsExceptionEncodedDataForError(data)) { return data.DecodeExceptionEncodedData(); } } return null; } } }