11namespace OneBitSoftware . Utilities . OperationResult
22{
33 using Microsoft . Extensions . Logging ;
4+ using OneBitSoftware . Utilities . OperationResult . Errors ;
45 using System ;
56 using System . Collections . Generic ;
67 using System . Linq ;
1011 /// </summary>
1112 public class OperationResult
1213 {
13- private readonly List < Error > _errors = new ( ) ;
14+ private readonly List < OperationError > _errors = new ( ) ;
1415 private readonly ILogger ? _logger ;
1516
1617 /// <summary>
@@ -26,7 +27,7 @@ public class OperationResult
2627 /// <summary>
2728 /// Gets an <see cref="List{T}"/> containing the error codes and messages of the <see cref="OperationResult{T}" />.
2829 /// </summary>
29- public IReadOnlyCollection < Error > Errors => this . _errors . AsReadOnly ( ) ;
30+ public IReadOnlyCollection < OperationError > Errors => this . _errors . AsReadOnly ( ) ;
3031
3132 /// <summary>
3233 /// Gets or sets the first exception that resulted from the operation.
@@ -71,7 +72,7 @@ public OperationResult AppendError(string message, int errorCode = 0, LogLevel?
7172 if ( message is null ) throw new ArgumentNullException ( nameof ( message ) ) ;
7273 if ( string . IsNullOrWhiteSpace ( message ) ) throw new ArgumentNullException ( nameof ( message ) ) ;
7374
74- var error = new Error { Message = message , Code = errorCode } ;
75+ var error = new OperationError ( message , errorCode ) ;
7576 this . AppendError ( error , logLevel ) ;
7677
7778 return this ;
@@ -100,7 +101,7 @@ public OperationResult AppendException(Exception exception, int errorCode = 0, L
100101 // Append the exception as a first if it is not yet set.
101102 this . InitialException ??= exception ;
102103
103- var error = new Error { Message = exception . ToString ( ) , Code = errorCode } ;
104+ var error = new OperationError ( exception . ToString ( ) , errorCode ) ;
104105 this . AppendError ( error , logLevel ) ;
105106
106107 return this ;
@@ -199,7 +200,7 @@ public void ValidateAny<T>(IEnumerable<T> value, string className, string method
199200
200201 private static LogLevel GetLogLevel ( LogLevel ? optionalLevel ) => optionalLevel ?? LogLevel . Error ;
201202
202- private void AppendError ( Error error , LogLevel ? logLevel )
203+ private void AppendError ( OperationError error , LogLevel ? logLevel )
203204 {
204205 this . AppendError ( error ) ;
205206
@@ -209,7 +210,7 @@ private void AppendError(Error error, LogLevel? logLevel)
209210 }
210211 }
211212
212- private void AppendError ( Error error ) => this . _errors . Add ( error ) ;
213+ private void AppendError ( OperationError error ) => this . _errors . Add ( error ) ;
213214 }
214215
215216 /// <summary>
0 commit comments