Skip to content

Commit

Permalink
Merge pull request #76 from amantinband/feature/add-covariant-error-o…
Browse files Browse the repository at this point in the history
…r-interface

Add covariant error or interface
  • Loading branch information
amantinband authored Jan 2, 2024
2 parents bfca762 + d27a3da commit ac34eb5
Show file tree
Hide file tree
Showing 3 changed files with 316 additions and 302 deletions.
18 changes: 9 additions & 9 deletions src/Error.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,6 @@ public readonly record struct Error
/// </summary>
public Dictionary<string, object>? Dictionary { get; }

private Error(string code, string description, ErrorType type, Dictionary<string, object>? dictionary)
{
Code = code;
Description = description;
Type = type;
NumericType = (int)type;
Dictionary = dictionary;
}

/// <summary>
/// Creates an <see cref="Error"/> of type <see cref="ErrorType.Failure"/> from a code and description.
/// </summary>
Expand Down Expand Up @@ -125,4 +116,13 @@ public static Error Custom(
string description,
Dictionary<string, object>? dictionary = null) =>
new(code, description, (ErrorType)type, dictionary);

private Error(string code, string description, ErrorType type, Dictionary<string, object>? dictionary)
{
Code = code;
Description = description;
Type = type;
NumericType = (int)type;
Dictionary = dictionary;
}
}
Loading

0 comments on commit ac34eb5

Please sign in to comment.