Skip to content

Commit

Permalink
fix: adjust error handling (#261)
Browse files Browse the repository at this point in the history
* use framework-version of GeneralHttpErrorHandler
  • Loading branch information
Phil91 authored Feb 13, 2025
1 parent 199553d commit 6391eee
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 152 deletions.
4 changes: 2 additions & 2 deletions src/database/PolicyHub.DbAccess/PolicyHub.DbAccess.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="9.0.1" />
<PackageReference Include="Org.Eclipse.TractusX.Portal.Backend.Framework.DependencyInjection" Version="3.5.0" />
<PackageReference Include="Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling" Version="3.5.0" />
<PackageReference Include="Org.Eclipse.TractusX.Portal.Backend.Framework.DependencyInjection" Version="3.7.0" />
<PackageReference Include="Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling" Version="3.7.0" />
</ItemGroup>

</Project>
6 changes: 3 additions & 3 deletions src/database/PolicyHub.Migrations/PolicyHub.Migrations.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.1" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="9.0.1" />
<PackageReference Include="Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess" Version="3.5.0" />
<PackageReference Include="Org.Eclipse.TractusX.Portal.Backend.Framework.Logging" Version="3.5.0" />
<PackageReference Include="Org.Eclipse.TractusX.Portal.Backend.Framework.Seeding" Version="3.5.0" />
<PackageReference Include="Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess" Version="3.7.0" />
<PackageReference Include="Org.Eclipse.TractusX.Portal.Backend.Framework.Logging" Version="3.7.0" />
<PackageReference Include="Org.Eclipse.TractusX.Portal.Backend.Framework.Seeding" Version="3.7.0" />
</ItemGroup>

<ItemGroup>
Expand Down
144 changes: 0 additions & 144 deletions src/hub/PolicyHub.Service/ErrorHandling/GeneralHttpErrorHandler.cs

This file was deleted.

4 changes: 2 additions & 2 deletions src/hub/PolicyHub.Service/PolicyHub.Service.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
<PackageReference Include="Flurl.Signed" Version="4.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.1" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.1" />
<PackageReference Include="Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Web" Version="3.5.0" />
<PackageReference Include="Org.Eclipse.TractusX.Portal.Backend.Framework.Web" Version="3.5.0" />
<PackageReference Include="Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Web" Version="3.7.0" />
<PackageReference Include="Org.Eclipse.TractusX.Portal.Backend.Framework.Web" Version="3.7.0" />
<PackageReference Include="System.Json" Version="4.8.0" />
<PackageReference Include="System.Linq" Version="4.3.0" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
Expand Down
4 changes: 3 additions & 1 deletion src/hub/PolicyHub.Service/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
using Org.Eclipse.TractusX.PolicyHub.Service.Controllers;
using Org.Eclipse.TractusX.PolicyHub.Service.ErrorHandling;
using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Service;
using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Web;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Extensions;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Web;
using System.Text.Json.Serialization;
Expand All @@ -34,6 +35,7 @@ await WebApplicationBuildRunner
builder =>
{
builder.Services
.AddTransient<GeneralHttpExceptionMiddleware>()
.AddSingleton<IErrorMessageService, ErrorMessageService>()
.AddSingleton<IErrorMessageContainer, ErrorMessageContainer>()
.AddTransient<IClaimsTransformation, KeycloakClaimsTransformation>()
Expand All @@ -50,7 +52,7 @@ await WebApplicationBuildRunner
},
(app, _) =>
{
app.UseMiddleware<GeneralHttpErrorHandler>();
app.UseMiddleware<GeneralHttpExceptionMiddleware>();
app.MapGroup("/api")
.WithOpenApi()
.MapPolicyHubApi();
Expand Down

0 comments on commit 6391eee

Please sign in to comment.