-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathOperationError.cs
More file actions
35 lines (25 loc) · 961 Bytes
/
OperationError.cs
File metadata and controls
35 lines (25 loc) · 961 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
namespace OneBitSoftware.Utilities.Errors
{
using System.Text;
using Microsoft.Extensions.Logging;
public class OperationError : IOperationError
{
public OperationError(string? message = null, int? code = null, string? details = null)
{
this.Message = message;
this.Code = code;
this.Details = details;
}
public int? Code { get; set; }
public string? Message { get; set; }
public string? Details { get; set; }
public override string ToString()
{
var result = new StringBuilder();
if (this.Code != null) result.AppendLine($"Code: {this.Code}");
if (!string.IsNullOrWhiteSpace(this.Message)) result.AppendLine($"Message: {this.Message}");
if (!string.IsNullOrWhiteSpace(this.Details)) result.AppendLine($"Trace: {this.Details}");
return result.ToString();
}
}
}