Follow-up example update (#33597)

pull/33589/head
Luke Latham 2024-09-12 14:50:28 -04:00 committed by GitHub
parent 1e5dc4ba9c
commit 1c36c72daa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 3 deletions

View File

@ -454,7 +454,7 @@ The following example permits the user to recover from the exception with a butt
}
```
You can also subclass <xref:Microsoft.AspNetCore.Components.Web.ErrorBoundary> for custom processing by overriding <xref:Microsoft.AspNetCore.Components.Web.ErrorBoundary.OnErrorAsync%2A>. The following example merely logs the error, but you can implement any error handling code you wish. You can remove the line that returns a <xref:System.Threading.Tasks.Task.CompletedTask> if your code awaits an asynchronous task.
You can also subclass <xref:Microsoft.AspNetCore.Components.Web.ErrorBoundary> for custom processing by overriding <xref:Microsoft.AspNetCore.Components.Web.ErrorBoundary.OnErrorAsync%2A>. The following example merely logs the error, but you can implement any error handling code you wish. You can remove the line that awaits a <xref:System.Threading.Tasks.Task.CompletedTask> if your code awaits an asynchronous task.
`CustomErrorBoundary.razor`:
@ -475,7 +475,7 @@ else if (ErrorContent is not null)
protected override Task OnErrorAsync(Exception ex)
{
Logger.LogError(ex, "😈 A rotten gremlin got us. Sorry!");
return Task.CompletedTask;
await Task.CompletedTask;
}
}
```
@ -498,7 +498,7 @@ public class CustomErrorBoundary : ErrorBoundary
protected override async Task OnErrorAsync(Exception ex)
{
Logger.LogError(ex, "😈 A rotten gremlin got us. Sorry!");
return Task.CompletedTask;
await Task.CompletedTask;
}
}
```