Prob details in the right place /5 (#29903)

* Prob details in the right place /5

* Prob details in the right place /5
pull/29904/head
Rick Anderson 2023-07-24 13:03:50 -10:00 committed by GitHub
parent 8a4da71bce
commit 5da9d23328
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 8 deletions

View File

@ -261,7 +261,7 @@ For information about how to handle model state errors, see [Model binding](xref
The following code configures the app to generate a problem details response for all HTTP client and server error responses that ***don't have a body content yet***:
:::code language="csharp" source="~/fundamentals/error-handling/samples/7.x/ErrorHandlingSample/Snippets/Program.cs" id="snippet_AddProblemDetails" highlight="3":::
:::code language="csharp" source="~/fundamentals/error-handling/samples/7.x/ErrorHandlingSample/Snippets/Program.cs" id="snippet_AddProblemDetails" highlight="1":::
The next section shows how to customize the problem details response body.

View File

@ -221,7 +221,7 @@ For information about how to handle model state errors, see [Model binding](xref
The following code configures the app to generate a problem details response for all HTTP client and server error responses that ***don't have a body content yet***:
:::code language="csharp" source="~/fundamentals/error-handling/samples/7.x/ErrorHandlingSample/Snippets/Program.cs" id="snippet_AddProblemDetails" highlight="3":::
:::code language="csharp" source="~/fundamentals/error-handling/samples/7.x/ErrorHandlingSample/Snippets/Program.cs" id="snippet_AddProblemDetails" highlight="1":::
The next section shows how to customize the problem details response body.

View File

@ -1,4 +1,4 @@
using Microsoft.AspNetCore.Diagnostics;
using Microsoft.AspNetCore.Diagnostics;
using static System.Net.Mime.MediaTypeNames;
namespace ErrorHandlingSample.Snippets;
@ -138,10 +138,10 @@ public static class Program
public static void AddProblemDetails(WebApplicationBuilder builder)
{
// <snippet_AddProblemDetails>
var app = builder.Build();
builder.Services.AddProblemDetails();
var app = builder.Build();
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler();

View File

@ -1,4 +1,4 @@
using Microsoft.AspNetCore.Diagnostics;
using Microsoft.AspNetCore.Diagnostics;
using static System.Net.Mime.MediaTypeNames;
namespace ErrorHandlingSample.Snippets;
@ -138,10 +138,10 @@ public static class Program
public static void AddProblemDetails(WebApplicationBuilder builder)
{
// <snippet_AddProblemDetails>
var app = builder.Build();
builder.Services.AddProblemDetails();
var app = builder.Build();
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler();