Skip to content

Commit

Permalink
Update the type of ResultError#InnerError
Browse files Browse the repository at this point in the history
Updated the Failure method to use ResultError<ErrorCategory> for enhanced error categorization. Also, changed the InnerError property type to ResultErrorBase for consistency.
  • Loading branch information
ahmedkamalio committed Nov 16, 2024
1 parent 1e694e8 commit 432b8a9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/ResultObject/Result.Constructor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public static Result<TValue> Success<TValue>(TValue value) where TValue : notnul
/// }
/// </code>
/// </example>
public static Result<TValue> Failure<TValue>(ResultError error)
public static Result<TValue> Failure<TValue>(ResultError<ErrorCategory> error)
where TValue : notnull => new(default, error);

/// <summary>
Expand Down
6 changes: 3 additions & 3 deletions src/ResultObject/ResultError.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public abstract record ResultErrorBase(
string Code,
string Reason,
string Message,
ResultError? InnerError,
ResultErrorBase? InnerError,
string? StackTrace
)
{
Expand Down Expand Up @@ -104,7 +104,7 @@ public record ResultError<TErrorCategory>(
string Reason,
string Message,
TErrorCategory? Category = null,
ResultError? InnerError = null,
ResultErrorBase? InnerError = null,
string? StackTrace = null) : ResultErrorBase(Code, Reason, Message, InnerError, StackTrace)
where TErrorCategory : struct, Enum
{
Expand Down Expand Up @@ -188,7 +188,7 @@ public record ResultError(
string Reason,
string Message,
ErrorCategory? Category = null,
ResultError? InnerError = null,
ResultErrorBase? InnerError = null,
string? StackTrace = null)
: ResultError<ErrorCategory>(Code, Reason, Message, Category, InnerError, StackTrace)
{
Expand Down
2 changes: 1 addition & 1 deletion src/ResultObject/ResultObject.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<!-- NuGet Package Metadata -->
<Title>.Net ResultObject</Title>
<PackageId>ResultObject</PackageId>
<Version>1.1.2</Version>
<Version>1.1.3</Version>
<Authors>Ahmed Kamal</Authors>
<Description>A robust Result type for .NET with built-in error categorization, supporting type-safe success/failure scenarios without exceptions.</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down

0 comments on commit 432b8a9

Please sign in to comment.