Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
IExceptionHandler.TryHandleAsync Method
Definition
- Namespace:
- Microsoft.AspNetCore.Diagnostics
- Assembly:
- Microsoft.AspNetCore.Diagnostics.dll
- Package:
- Microsoft.AspNetCore.App.Ref v10.0.0
- Package:
- Microsoft.AspNetCore.App.Ref v11.0.0-preview.4.26230.115
- Package:
- Microsoft.AspNetCore.App.Ref v8.0.19
- Package:
- Microsoft.AspNetCore.App.Ref v9.0.8
- Source:
- IExceptionHandler.cs
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Tries to handle the specified exception asynchronously within the ASP.NET Core pipeline. Implementations of this method can provide custom exception-handling logic for different scenarios.
public System.Threading.Tasks.ValueTask<bool> TryHandleAsync(Microsoft.AspNetCore.Http.HttpContext httpContext, Exception exception, System.Threading.CancellationToken cancellationToken);
abstract member TryHandleAsync : Microsoft.AspNetCore.Http.HttpContext * Exception * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<bool>
Public Function TryHandleAsync (httpContext As HttpContext, exception As Exception, cancellationToken As CancellationToken) As ValueTask(Of Boolean)
Parameters
- httpContext
- HttpContext
The HttpContext for the request.
- exception
- Exception
The unhandled exception.
- cancellationToken
- CancellationToken
The cancellation token.
Returns
A task that represents the asynchronous read operation. The value of its Result
property contains the result of the handling operation.
true if the exception was handled successfully; otherwise false.
Applies to
Feedback
Was this page helpful?
