Skip to content
This repository was archived by the owner on Aug 30, 2025. It is now read-only.

Commit 84d2034

Browse files
committed
fix: Marked all implementations as Obsolete
BREAKING CHANGE: Deprecated package
1 parent fbbd833 commit 84d2034

File tree

12 files changed

+245
-17
lines changed

12 files changed

+245
-17
lines changed

src/ErrorExtensions.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,27 @@
44

55
namespace PowerUtils.Results
66
{
7+
[Obsolete("This package has been discontinued because it never evolved, and the code present in this package does not justify its continuation. It is preferable to implement this code directly in the project if necessary.")]
78
public static class ErrorExtensions
89
{
910
/// <summary>
1011
/// Get Errors as a list
1112
/// </summary>
13+
[Obsolete("This package has been discontinued because it never evolved, and the code present in this package does not justify its continuation. It is preferable to implement this code directly in the project if necessary.")]
1214
public static List<IError>? AsList(this IEnumerable<IError>? errors) => errors as List<IError>;
1315

1416

1517
/// <summary>
1618
/// Gets the first error
1719
/// </summary>
20+
[Obsolete("This package has been discontinued because it never evolved, and the code present in this package does not justify its continuation. It is preferable to implement this code directly in the project if necessary.")]
1821
public static IError FirstError(this IResult result)
1922
=> result.Errors.First();
2023

2124
/// <summary>
2225
/// Gets the first error, if does not contain errors returns null
2326
/// </summary>
27+
[Obsolete("This package has been discontinued because it never evolved, and the code present in this package does not justify its continuation. It is preferable to implement this code directly in the project if necessary.")]
2428
public static IError? FirstOrDefaultError(this IResult result)
2529
{
2630
if(!result.IsError)
@@ -34,6 +38,7 @@ public static IError FirstError(this IResult result)
3438
/// <summary>
3539
/// Gets the first error that satisfies the condition otherwise returns null
3640
/// </summary>
41+
[Obsolete("This package has been discontinued because it never evolved, and the code present in this package does not justify its continuation. It is preferable to implement this code directly in the project if necessary.")]
3742
public static IError? FirstOrDefaultError(this IResult result, Func<IError, bool> predicate)
3843
{
3944
if(!result.IsError)
@@ -47,12 +52,14 @@ public static IError FirstError(this IResult result)
4752
/// <summary>
4853
/// Gets the last error
4954
/// </summary>
55+
[Obsolete("This package has been discontinued because it never evolved, and the code present in this package does not justify its continuation. It is preferable to implement this code directly in the project if necessary.")]
5056
public static IError LastError(this IResult result)
5157
=> result.Errors.Last();
5258

5359
/// <summary>
5460
/// Gets the last error, if does not contain errors returns null
5561
/// </summary>
62+
[Obsolete("This package has been discontinued because it never evolved, and the code present in this package does not justify its continuation. It is preferable to implement this code directly in the project if necessary.")]
5663
public static IError? LastOrDefaultError(this IResult result)
5764
{
5865
if(!result.IsError)
@@ -66,6 +73,7 @@ public static IError LastError(this IResult result)
6673
/// <summary>
6774
/// Gets the last error that satisfies the condition otherwise returns null
6875
/// </summary>
76+
[Obsolete("This package has been discontinued because it never evolved, and the code present in this package does not justify its continuation. It is preferable to implement this code directly in the project if necessary.")]
6977
public static IError? LastOrDefaultError(this IResult result, Func<IError, bool> predicate)
7078
{
7179
if(!result.IsError)
@@ -79,12 +87,14 @@ public static IError LastError(this IResult result)
7987
/// <summary>
8088
/// Gets the error when only exists one
8189
/// </summary>
90+
[Obsolete("This package has been discontinued because it never evolved, and the code present in this package does not justify its continuation. It is preferable to implement this code directly in the project if necessary.")]
8291
public static IError SingleError(this IResult result)
8392
=> result.Errors.Single();
8493

8594
/// <summary>
8695
/// Gets the error when only exists one, if does not contain errors returns null
8796
/// </summary>
97+
[Obsolete("This package has been discontinued because it never evolved, and the code present in this package does not justify its continuation. It is preferable to implement this code directly in the project if necessary.")]
8898
public static IError? SingleOrDefaultError(this IResult result)
8999
{
90100
if(!result.IsError)
@@ -98,6 +108,7 @@ public static IError SingleError(this IResult result)
98108
/// <summary>
99109
/// Gets the error when only one satisfies the condition otherwise returns null
100110
/// </summary>
111+
[Obsolete("This package has been discontinued because it never evolved, and the code present in this package does not justify its continuation. It is preferable to implement this code directly in the project if necessary.")]
101112
public static IError? SingleOrDefaultError(this IResult result, Func<IError, bool> predicate)
102113
{
103114
if(!result.IsError)

src/ErrorFactory.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
namespace PowerUtils.Results
1+
using System;
2+
3+
namespace PowerUtils.Results
24
{
35
#if NET6_0_OR_GREATER
46
public readonly partial record struct Error : IError
57
#else
8+
[Obsolete("This package has been discontinued because it never evolved, and the code present in this package does not justify its continuation. It is preferable to implement this code directly in the project if necessary.")]
69
public partial struct Error : IError
710
#endif
811
{
912
/// <summary>
1013
/// Creates a custom error result with the given error similar to a BadRequest:400
1114
/// </summary>
15+
[Obsolete("This package has been discontinued because it never evolved, and the code present in this package does not justify its continuation. It is preferable to implement this code directly in the project if necessary.")]
1216
public static Error Failure(string property, string code, string? description = null)
1317
=> new(property, code, description);
1418

@@ -17,12 +21,14 @@ public static Error Failure(string property, string code, string? description =
1721
/// <summary>
1822
/// Creates an 'Unauthorized:401' error result with the given error
1923
/// </summary>
24+
[Obsolete("This package has been discontinued because it never evolved, and the code present in this package does not justify its continuation. It is preferable to implement this code directly in the project if necessary.")]
2025
public static UnauthorizedError Unauthorized(string property, string code, string? description = null)
2126
=> new(property, code, description);
2227

2328
/// <summary>
2429
/// Creates an 'Unauthorized:401' error result with the given error and code: 'UNAUTHORIZED'
2530
/// </summary>
31+
[Obsolete("This package has been discontinued because it never evolved, and the code present in this package does not justify its continuation. It is preferable to implement this code directly in the project if necessary.")]
2632
public static UnauthorizedError Unauthorized(string property, string? description = null)
2733
=> new(property, ResultErrorCodes.UNAUTHORIZED, description);
2834

@@ -31,12 +37,14 @@ public static UnauthorizedError Unauthorized(string property, string? descriptio
3137
/// <summary>
3238
/// Creates an 'Forbidden:403' error result with the given error
3339
/// </summary>
40+
[Obsolete("This package has been discontinued because it never evolved, and the code present in this package does not justify its continuation. It is preferable to implement this code directly in the project if necessary.")]
3441
public static ForbiddenError Forbidden(string property, string code, string? description = null)
3542
=> new(property, code, description);
3643

3744
/// <summary>
3845
/// Creates an 'Forbidden:403' error result with the given error and code: 'FORBIDDEN'
3946
/// </summary>
47+
[Obsolete("This package has been discontinued because it never evolved, and the code present in this package does not justify its continuation. It is preferable to implement this code directly in the project if necessary.")]
4048
public static ForbiddenError Forbidden(string property, string? description = null)
4149
=> new(property, ResultErrorCodes.FORBIDDEN, description);
4250

@@ -45,12 +53,14 @@ public static ForbiddenError Forbidden(string property, string? description = nu
4553
/// <summary>
4654
/// Creates an 'NotFound:404' error result with the given error
4755
/// </summary>
56+
[Obsolete("This package has been discontinued because it never evolved, and the code present in this package does not justify its continuation. It is preferable to implement this code directly in the project if necessary.")]
4857
public static NotFoundError NotFound(string property, string code, string? description = null)
4958
=> new(property, code, description);
5059

5160
/// <summary>
5261
/// Creates an 'NotFound:404' error result with the given error and code: 'NOT_FOUND'
5362
/// </summary>
63+
[Obsolete("This package has been discontinued because it never evolved, and the code present in this package does not justify its continuation. It is preferable to implement this code directly in the project if necessary.")]
5464
public static NotFoundError NotFound(string property, string? description = null)
5565
=> new(property, ResultErrorCodes.NOT_FOUND, description);
5666

@@ -59,12 +69,14 @@ public static NotFoundError NotFound(string property, string? description = null
5969
/// <summary>
6070
/// Creates an 'Conflict:409' error result with the given error
6171
/// </summary>
72+
[Obsolete("This package has been discontinued because it never evolved, and the code present in this package does not justify its continuation. It is preferable to implement this code directly in the project if necessary.")]
6273
public static ConflictError Conflict(string property, string code, string? description = null)
6374
=> new(property, code, description);
6475

6576
/// <summary>
6677
/// Creates an 'Conflict:409' error result with the given error and code: 'CONFLICT'
6778
/// </summary>
79+
[Obsolete("This package has been discontinued because it never evolved, and the code present in this package does not justify its continuation. It is preferable to implement this code directly in the project if necessary.")]
6880
public static ConflictError Conflict(string property, string? description = null)
6981
=> new(property, ResultErrorCodes.CONFLICT, description);
7082

@@ -73,12 +85,14 @@ public static ConflictError Conflict(string property, string? description = null
7385
/// <summary>
7486
/// Create an 'Validation:400' error result with the given error
7587
/// </summary>
88+
[Obsolete("This package has been discontinued because it never evolved, and the code present in this package does not justify its continuation. It is preferable to implement this code directly in the project if necessary.")]
7689
public static ValidationError Validation(string property, string code, string? description = null)
7790
=> new(property, code, description);
7891

7992
/// <summary>
8093
/// Create an 'Validation:400' error result with the given error and code: 'VALIDATION'
8194
/// </summary>
95+
[Obsolete("This package has been discontinued because it never evolved, and the code present in this package does not justify its continuation. It is preferable to implement this code directly in the project if necessary.")]
8296
public static ValidationError Validation(string property, string? description = null)
8397
=> new(property, ResultErrorCodes.VALIDATION, description);
8498

@@ -87,12 +101,14 @@ public static ValidationError Validation(string property, string? description =
87101
/// <summary>
88102
/// Create an 'Unexpected:500' error result with the given error
89103
/// </summary>
104+
[Obsolete("This package has been discontinued because it never evolved, and the code present in this package does not justify its continuation. It is preferable to implement this code directly in the project if necessary.")]
90105
public static UnexpectedError Unexpected(string property, string code, string? description = null)
91106
=> new(property, code, description);
92107

93108
/// <summary>
94109
/// Create an 'Unexpected:500' error result with the given error and code: 'UNEXPECTED'
95110
/// </summary>
111+
[Obsolete("This package has been discontinued because it never evolved, and the code present in this package does not justify its continuation. It is preferable to implement this code directly in the project if necessary.")]
96112
public static UnexpectedError Unexpected(string property, string? description = null)
97113
=> new(property, ResultErrorCodes.UNEXPECTED, description);
98114

0 commit comments

Comments
 (0)