chore: Update problem details extensions for more additional info

This commit is contained in:
Pc 2023-04-07 20:14:27 +03:30
parent 5954846d69
commit f72e0f02b7
4 changed files with 4 additions and 9 deletions

View File

@ -45,7 +45,6 @@ public static class ProblemDetailsExtensions
if (context.RequestServices.GetService<IProblemDetailsService>() is { } problemDetailsService)
{
var env = context.RequestServices.GetRequiredService<IWebHostEnvironment>();
var exceptionHandlerFeature = context.Features.Get<IExceptionHandlerFeature>();
var exceptionType = exceptionHandlerFeature?.Error;
@ -114,7 +113,7 @@ public static class ProblemDetailsExtensions
}
};
if (env.IsDevelopment())
if (app.Environment.IsDevelopment())
{
problem.ProblemDetails.Extensions.Add("exception", exceptionHandlerFeature?.Error.ToString());
}

View File

@ -35,7 +35,6 @@ public static class ProblemDetailsExtensions
});
}
});
});
app.UseExceptionHandler(exceptionHandlerApp =>
@ -46,7 +45,6 @@ public static class ProblemDetailsExtensions
if (context.RequestServices.GetService<IProblemDetailsService>() is { } problemDetailsService)
{
var env = context.RequestServices.GetRequiredService<IWebHostEnvironment>();
var exceptionHandlerFeature = context.Features.Get<IExceptionHandlerFeature>();
var exceptionType = exceptionHandlerFeature?.Error;
@ -115,7 +113,7 @@ public static class ProblemDetailsExtensions
}
};
if (env.IsDevelopment())
if (app.Environment.IsDevelopment())
{
problem.ProblemDetails.Extensions.Add("exception", exceptionHandlerFeature?.Error.ToString());
}

View File

@ -45,7 +45,6 @@ public static class ProblemDetailsExtensions
if (context.RequestServices.GetService<IProblemDetailsService>() is { } problemDetailsService)
{
var env = context.RequestServices.GetRequiredService<IWebHostEnvironment>();
var exceptionHandlerFeature = context.Features.Get<IExceptionHandlerFeature>();
var exceptionType = exceptionHandlerFeature?.Error;
@ -114,7 +113,7 @@ public static class ProblemDetailsExtensions
}
};
if (env.IsDevelopment())
if (app.Environment.IsDevelopment())
{
problem.ProblemDetails.Extensions.Add("exception", exceptionHandlerFeature?.Error.ToString());
}

View File

@ -45,7 +45,6 @@ public static class ProblemDetailsExtensions
if (context.RequestServices.GetService<IProblemDetailsService>() is { } problemDetailsService)
{
var env = context.RequestServices.GetRequiredService<IWebHostEnvironment>();
var exceptionHandlerFeature = context.Features.Get<IExceptionHandlerFeature>();
var exceptionType = exceptionHandlerFeature?.Error;
@ -114,7 +113,7 @@ public static class ProblemDetailsExtensions
}
};
if (env.IsDevelopment())
if (app.Environment.IsDevelopment())
{
problem.ProblemDetails.Extensions.Add("exception", exceptionHandlerFeature?.Error.ToString());
}