コード例 #1
0
        public INonEmptyStringState ResolveFor(IOperationError error)
        {
            foreach (IOperationErrorMessageSpecification operationErrorMessageSpecification in ErrorSpecifications)
            {
                switch (error.Exception)
                {
                case AggregateException ae:
                    foreach (Exception innerException in ae.InnerExceptions)
                    {
                        if (innerException.InnerException == null &&
                            operationErrorMessageSpecification.Match(innerException) is NonEmptyString leaf)
                        {
                            return(leaf);
                        }

                        // do one level of nesting
                        if (operationErrorMessageSpecification.Match(innerException.InnerException) is NonEmptyString nodeParent)
                        {
                            return(nodeParent);
                        }
                    }
                    break;

                case Exception exception
                    when operationErrorMessageSpecification.Match(exception) is NonEmptyString matched:
                    return(matched);
                }
            }

            return(new DefaultOperationErrorSpecification().Match(error.Exception));
        }
コード例 #2
0
 public OperationResult(IOperationError error) : base(error)
 {
 }
 new public static OperationResult <T> FromError(IOperationError error)
 => new OperationResult <T>(error);
 internal protected OperationResult(IOperationError error)
     : base(error)
 {
 }
コード例 #5
0
 public static OperationResult FromError(IOperationError error)
 => new OperationResult(error);
コード例 #6
0
 public InvalidDatabaseSchema(IOperationError error)
 {
     Error = error;
 }
コード例 #7
0
 internal protected OperationResult(IOperationError error)
 {
     IsSuccess = false;
     _error    = error ?? throw new ArgumentNullException(nameof(error));
 }