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

Commit 9606668

Browse files
committed
fix: Marked all implementations as Obsolete
BREAKING CHANGE: Deprecated package
1 parent 735a666 commit 9606668

File tree

8 files changed

+41
-11
lines changed

8 files changed

+41
-11
lines changed

src/ErrorHandlerExtensions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace PowerUtils.AspNetCore.ErrorHandler
1111
{
12+
[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.")]
1213
public static class ErrorHandlerExtensions
1314
{
1415
/// <summary>
@@ -17,6 +18,7 @@ public static class ErrorHandlerExtensions
1718
/// </summary>
1819
/// <param name="services">The service collection to add the services to.</param>
1920
/// <param name="options">Options for handling exceptions and errors</param>
21+
[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.")]
2022
public static IServiceCollection AddErrorHandler(this IServiceCollection services, Action<ErrorHandlerOptions> options = null)
2123
{
2224
services.Configure<ApiBehaviorOptions>(options =>
@@ -70,6 +72,7 @@ public static IServiceCollection AddErrorHandler(this IServiceCollection service
7072
/// Adds the <see cref="ErrorHandlerMiddleware"/> and <see cref="ExceptionHandlerMiddleware"/> to the application pipeline.
7173
/// </summary>
7274
/// <param name="app">The application builder to add the middleware to.</param>
75+
[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.")]
7376
public static IApplicationBuilder UseErrorHandler(this IApplicationBuilder app)
7477
=> app
7578
.UseExceptionHandler(config => config.Run(ExceptionHandlerMiddleware.Handler))

src/ErrorHandlerOptions.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,35 @@
55

66
namespace PowerUtils.AspNetCore.ErrorHandler
77
{
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.")]
89
public interface IExceptionMapper
910
{
1011
(int Status, IEnumerable<KeyValuePair<string, ErrorDetails>> Errors) Handle(Exception exception);
1112
}
1213

1314

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.")]
1416
public class ExceptionMapper<TException> : IExceptionMapper
1517
where TException : Exception
1618
{
19+
[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.")]
1720
public Func<TException, (int Status, IEnumerable<KeyValuePair<string, ErrorDetails>>)> Handler { get; set; }
1821

1922

23+
[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.")]
2024
public (int Status, IEnumerable<KeyValuePair<string, ErrorDetails>> Errors) Handle(Exception exception)
2125
=> Handler(exception as TException);
2226
}
2327

2428

29+
[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.")]
2530
public class ErrorHandlerOptions
2631
{
2732
private PropertyNamingPolicy _propertyNamingPolicy = PropertyNamingPolicy.CamelCase;
2833
/// <summary>
2934
/// Default value: CamelCase
3035
/// </summary>
36+
[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.")]
3137
public PropertyNamingPolicy PropertyNamingPolicy
3238
{
3339
get => _propertyNamingPolicy;
@@ -38,10 +44,12 @@ public PropertyNamingPolicy PropertyNamingPolicy
3844
}
3945
}
4046

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.")]
4148
public IDictionary<Type, IExceptionMapper> ExceptionMappers { get; set; } = new Dictionary<Type, IExceptionMapper>();
4249

4350
internal Func<string, string> PropertyHandler { get; set; }
4451

52+
[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.")]
4553
public ErrorHandlerOptions()
4654
{
4755
ExceptionMappers.Add(
@@ -69,8 +77,10 @@ public ErrorHandlerOptions()
6977
}
7078
}
7179

80+
[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.")]
7281
public static class ErrorHandlerOptionsExtensions
7382
{
83+
[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.")]
7484
public static void ExceptionMapper<TException>(this ErrorHandlerOptions options, Func<TException, (int Status, IEnumerable<KeyValuePair<string, ErrorDetails>> Errors)> configureMapper)
7585
where TException : Exception
7686
{
@@ -92,10 +102,12 @@ public static void ExceptionMapper<TException>(this ErrorHandlerOptions options,
92102
}
93103
}
94104

105+
[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.")]
95106
public static void ExceptionMapper<TException>(this ErrorHandlerOptions options, Func<TException, int> configureMapper)
96107
where TException : Exception
97108
=> options.ExceptionMapper<TException>(e => (configureMapper(e), ImmutableDictionary<string, ErrorDetails>.Empty));
98109

110+
[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.")]
99111
public static void ExceptionMapper<TException>(this ErrorHandlerOptions options, Func<TException, (int Status, string Property, string Code, string Description)> configureMapper)
100112
where TException : Exception => options.ExceptionMapper<TException>(e => (configureMapper(e).Status, new Dictionary<string, ErrorDetails>()
101113
{

src/ErrorProblemDetails.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
namespace PowerUtils.AspNetCore.ErrorHandler
99
{
1010
[JsonConverter(typeof(ErrorProblemDetailsJsonConverter))]
11+
[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.")]
1112
public class ErrorProblemDetails : ProblemDetails
1213
{
1314
/// <summary>
1415
/// ID generated by the problem to track logs
1516
/// </summary>
1617
[JsonPropertyName("traceId")]
18+
[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.")]
1719
public string TraceId { get; set; }
1820

1921
/// <summary>
@@ -22,40 +24,49 @@ public class ErrorProblemDetails : ProblemDetails
2224
/// <example>
2325
/// { "source": { "code: "", "description": "" } }
2426
/// </example>
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.")]
2528
public IDictionary<string, ErrorDetails> Errors { get; set; } = new Dictionary<string, ErrorDetails>(StringComparer.InvariantCultureIgnoreCase);
2629

2730
/// <summary>
2831
/// Initializes a new instance of <see cref="ErrorProblemDetails"/>.
2932
/// </summary>
33+
[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.")]
3034
public ErrorProblemDetails() { }
3135

3236
/// <summary>
3337
/// Serialize problem details to JSON
3438
/// </summary>
39+
[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.")]
3540
public override string ToString()
3641
=> JsonSerializer.Serialize(this);
3742

43+
[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.")]
3844
public static implicit operator string(ErrorProblemDetails problemDetailsResponse)
3945
=> problemDetailsResponse.ToString();
4046
}
4147

4248

49+
[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.")]
4350
public class ErrorDetails
4451
{
4552
/// <summary>
4653
/// Error code
4754
/// </summary>
4855
[JsonPropertyName("code")]
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.")]
4957
public string Code { get; set; }
5058

5159

5260
/// <summary>
5361
/// A human-readable explanation specific to this occurrence of the error.
5462
/// </summary>
5563
[JsonPropertyName("description")]
64+
[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.")]
5665
public string Description { get; set; }
5766

67+
[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.")]
5868
public ErrorDetails() { }
69+
[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.")]
5970
public ErrorDetails(
6071
string code,
6172
string description)
@@ -64,9 +75,11 @@ public ErrorDetails(
6475
Description = description;
6576
}
6677

78+
[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.")]
6779
public override string ToString()
6880
=> JsonSerializer.Serialize(this);
6981

82+
[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.")]
7083
public static implicit operator string(ErrorDetails errorDetails)
7184
=> errorDetails.ToString();
7285
}

src/HttpContextExtensions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace PowerUtils.AspNetCore.ErrorHandler
1111
{
12+
[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.")]
1213
public static class HttpContextExtensions
1314
{
1415
private static readonly HashSet<string> _allowedHeaderNames = new(StringComparer.OrdinalIgnoreCase)
@@ -26,6 +27,7 @@ public static class HttpContextExtensions
2627
};
2728

2829

30+
[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.")]
2931
public static string GetCorrelationId(this HttpContext httpContext)
3032
{
3133
var result = Activity.Current?.Id;

src/IProblemHandler.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
using System.Collections.Generic;
1+
using System;
2+
using System.Collections.Generic;
23
using Microsoft.AspNetCore.Mvc;
34

45
namespace PowerUtils.AspNetCore.ErrorHandler
56
{
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.")]
68
public interface IProblemFactory
79
{
810
/// <summary>

src/ProblemDetailsDefaults.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
using System.Collections.Generic;
1+
using System;
2+
using System.Collections.Generic;
23

34
namespace PowerUtils.AspNetCore.ErrorHandler
45
{
6+
[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.")]
57
public static class ProblemDetailsDefaults
68
{
9+
[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.")]
710
public const string PROBLEM_MEDIA_TYPE_JSON = "application/problem+json";
811

912
internal const int FALLBACK_STATUS_CODE = 500;

src/PropertyNamingPolicy.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
namespace PowerUtils.AspNetCore.ErrorHandler
1+
using System;
2+
3+
namespace PowerUtils.AspNetCore.ErrorHandler
24
{
5+
[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.")]
36
public enum PropertyNamingPolicy
47
{
58
Original,

tests/PowerUtils.AspNetCore.ErrorHandler.Tests/PowerUtils.AspNetCore.ErrorHandler.Tests.csproj

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,6 @@
1616
</PropertyGroup>
1717

1818

19-
<Target Name="CopyHook" AfterTargets="AfterBuild" Condition="'$(GITHUB_ACTIONS)' != 'true' ">
20-
<ItemGroup>
21-
<CommitHookFile Include="../../.github/hooks/commit-msg" />
22-
</ItemGroup>
23-
<Copy SourceFiles="@(CommitHookFile)" DestinationFolder="../../.git/hooks" />
24-
</Target>
25-
26-
2719
<ItemGroup>
2820
<PackageReference Include="NSubstitute" Version="5.3.0" />
2921
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.3.0" />

0 commit comments

Comments
 (0)