Skip to content

Commit 767e59f

Browse files
author
tgancheva
committed
Add details to append error method.
1 parent 926f3dd commit 767e59f

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

src/OneBitSoftware.Utilities.OperationResult/OperationResult.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,15 @@ public OperationResult AppendErrors(OperationResult otherOperationResult)
9797
/// This method will append an error with a specific `user-friendly` message to this operation result instance.
9898
/// </summary>
9999
/// <param name="message">A label consuming component defining the 'user-friendly' message.</param>
100-
/// <param name="errorCode">The unique code of the error.</param>
100+
/// <param name="code">The unique code of the error.</param>
101101
/// <param name="logLevel">The logging severity.</param>
102+
/// <param name="details">A <see cref="string"/> with error details.</param>
102103
/// <returns>The current instance of the <see cref="OperationResult"/>.</returns>
103-
public OperationResult AppendError(string message, int errorCode = 0, LogLevel? logLevel = null)
104+
public OperationResult AppendError(string message, int? code = null, LogLevel? logLevel = null, string? details = null)
104105
{
105106
if (string.IsNullOrWhiteSpace(message)) throw new ArgumentNullException(nameof(message));
106107

107-
var error = new OperationError(message, errorCode);
108+
var error = new OperationError(message, code) { Details = details };
108109
this.AppendError(error, logLevel);
109110

110111
return this;
@@ -219,12 +220,13 @@ public OperationResult(TResult resultObject) : base()
219220
/// This method will append an error with a specific `user-friendly` message to this operation result instance.
220221
/// </summary>
221222
/// <param name="message">A label consuming component defining the 'user-friendly' message.</param>
222-
/// <param name="errorCode">The unique code of the error.</param>
223+
/// <param name="code">The unique code of the error.</param>
223224
/// <param name="logLevel">The logging severity.</param>
225+
/// <param name="details">A <see cref="string"/> with error details.</param>
224226
/// <returns>The current instance of the <see cref="OperationResult{TResult}"/>.</returns>
225-
public new OperationResult<TResult> AppendError(string message, int errorCode = 0, LogLevel? logLevel = null)
227+
public new OperationResult<TResult> AppendError(string message, int? code = null, LogLevel? logLevel = null, string? details = null)
226228
{
227-
base.AppendError(message, errorCode, logLevel);
229+
base.AppendError(message, code, logLevel, details);
228230

229231
return this;
230232
}

0 commit comments

Comments
 (0)