From 432b8a9ca310b69a65bb0e85f75b0925a7a79828 Mon Sep 17 00:00:00 2001 From: Ahmed Kamal Date: Sat, 16 Nov 2024 03:56:33 +0200 Subject: [PATCH] Update the type of ResultError#InnerError Updated the Failure method to use ResultError for enhanced error categorization. Also, changed the InnerError property type to ResultErrorBase for consistency. --- src/ResultObject/Result.Constructor.cs | 2 +- src/ResultObject/ResultError.cs | 6 +++--- src/ResultObject/ResultObject.csproj | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ResultObject/Result.Constructor.cs b/src/ResultObject/Result.Constructor.cs index e0d8e62..57d3c85 100755 --- a/src/ResultObject/Result.Constructor.cs +++ b/src/ResultObject/Result.Constructor.cs @@ -124,7 +124,7 @@ public static Result Success(TValue value) where TValue : notnul /// } /// /// - public static Result Failure(ResultError error) + public static Result Failure(ResultError error) where TValue : notnull => new(default, error); /// diff --git a/src/ResultObject/ResultError.cs b/src/ResultObject/ResultError.cs index b29871b..90a01e1 100755 --- a/src/ResultObject/ResultError.cs +++ b/src/ResultObject/ResultError.cs @@ -7,7 +7,7 @@ public abstract record ResultErrorBase( string Code, string Reason, string Message, - ResultError? InnerError, + ResultErrorBase? InnerError, string? StackTrace ) { @@ -104,7 +104,7 @@ public record ResultError( 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 { @@ -188,7 +188,7 @@ public record ResultError( string Reason, string Message, ErrorCategory? Category = null, - ResultError? InnerError = null, + ResultErrorBase? InnerError = null, string? StackTrace = null) : ResultError(Code, Reason, Message, Category, InnerError, StackTrace) { diff --git a/src/ResultObject/ResultObject.csproj b/src/ResultObject/ResultObject.csproj index 50caa2e..7e7fd99 100755 --- a/src/ResultObject/ResultObject.csproj +++ b/src/ResultObject/ResultObject.csproj @@ -7,7 +7,7 @@ .Net ResultObject ResultObject - 1.1.2 + 1.1.3 Ahmed Kamal A robust Result type for .NET with built-in error categorization, supporting type-safe success/failure scenarios without exceptions. MIT