Class GatewayExceptionHandler
- Namespace
- FoundationaLLM.Gateway.Exceptions
- Assembly
- FoundationaLLM.Gateway.dll
Implements a global exception handler for the Gateway API.
public class GatewayExceptionHandler : IExceptionHandler
- Inheritance
-
GatewayExceptionHandler
- Implements
- Inherited Members
- Extension Methods
Constructors
GatewayExceptionHandler(ILogger<GatewayExceptionHandler>)
Implements a global exception handler for the Gateway API.
public GatewayExceptionHandler(ILogger<GatewayExceptionHandler> logger)
Parameters
logger
ILogger<GatewayExceptionHandler>The ILogger used for logging.
Methods
TryHandleAsync(HttpContext, Exception, CancellationToken)
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 ValueTask<bool> TryHandleAsync(HttpContext httpContext, Exception exception, CancellationToken cancellationToken)
Parameters
httpContext
HttpContextThe HttpContext for the request.
exception
ExceptionThe unhandled exception.
cancellationToken
CancellationTokenThe cancellation token.