コード例 #1
0
        private static Result <TIdentifier, TContent> RaiseFailFromResult <TIdentifier, TContent, TOtherContent>([NotNull] string errorMessage, [NotNull] IResult <TIdentifier, TOtherContent> otherResultOnError, string memberName, string sourceFilePath, int sourceLineNumber)
        {
            var e = new MainError(memberName, sourceFilePath, sourceLineNumber, errorMessage,
                                  otherResultOnError.Error?.InnerError, otherResultOnError.Error?.ErrorEventId);

            var m = new ResultChainFail <TIdentifier, TContent, TOtherContent>(otherResultOnError.TypedIdentifier,
                                                                               e, otherResultOnError);

            return(m);
        }
コード例 #2
0
        private static Result <TContent> RaiseFail <TContent>([NotNull] object id, [NotNull] TContent content, [NotNull] IError error, string memberName,
                                                              string sourceFilePath, int sourceLineNumber)
        {
            if (error is MainError e)
            {
                return(new ResultFail <TContent>(id, content, e));
            }

            var m = new MainError(memberName, sourceFilePath, sourceLineNumber, error.ErrorMessage, error?.InnerError, error?.ErrorEventId);

            return(new ResultFail <TContent>(id, content, m));
        }