Prob details in the right place /5 (#29903)
* Prob details in the right place /5 * Prob details in the right place /5pull/29904/head
parent
8a4da71bce
commit
5da9d23328
|
@ -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.
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue