Skip to content

Commit 03b98a8

Browse files
Merge pull request #8 from Stratis-Dermanoutsos/v9.0.7.2
Fixed Instance property
2 parents a980305 + 4193c42 commit 03b98a8

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

RestExceptions.slnx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
</Folder>
55
<Folder Name="/solution/">
66
<File Path=".editorconfig" />
7+
<File Path="build-pack.sh" />
78
<File Path="Directory.Build.props" />
89
<File Path="Directory.Packages.props" />
910
</Folder>
@@ -15,4 +16,4 @@
1516
<Folder Name="/src/">
1617
<Project Path="src\RestExceptions\RestExceptions.csproj" Type="Classic C#" />
1718
</Folder>
18-
</Solution>
19+
</Solution>

build-pack.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
set -e
3+
4+
cd ./src/RestExceptions
5+
dotnet clean
6+
dotnet build -c Release
7+
dotnet pack -c Release
8+
9+
# To run:
10+
# chmod +x build-pack.sh

src/RestExceptions/Extensions/ServiceCollectionExtensions.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@ public static IServiceCollection AddRestExceptions(this IServiceCollection servi
2323
{
2424
options.CustomizeProblemDetails = context =>
2525
{
26-
context.ProblemDetails.Instance =
27-
$"[{context.HttpContext.Request.Method}] {context.HttpContext.Request.Path}";
26+
context.ProblemDetails.Instance = context.HttpContext.Request.Path;
27+
context.ProblemDetails.Extensions.Add("method", context.HttpContext.Request.Method);
2828
context.ProblemDetails.Extensions.Add("requestId", context.HttpContext.TraceIdentifier);
29-
30-
var activity = context.HttpContext.Features.Get<IHttpActivityFeature>()?.Activity;
31-
context.ProblemDetails.Extensions.TryAdd("traceId", activity?.Id);
29+
context.ProblemDetails.Extensions.TryAdd("traceId",
30+
context.HttpContext.Features.Get<IHttpActivityFeature>()?.Activity.Id);
3231
};
3332
});
3433
services.AddExceptionHandler<RestExceptionHandler>();

src/RestExceptions/RestExceptions.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PackageId>RestExceptions</PackageId>
44
<Title>RestExceptions</Title>
55
<Description>Extensible Web API middleware that maps all exceptions to standardized REST-compliant error responses.</Description>
6-
<Version>9.0.7.1</Version>
6+
<Version>9.0.7.2</Version>
77
<TargetFramework>net9.0</TargetFramework>
88

99
<Authors>Stratis-Dermanoutsos</Authors>

0 commit comments

Comments
 (0)