Table of Contents

Class SemanticKernelExceptionHandler

Namespace
FoundationaLLM.SemanticKernel.Core.Exceptions
Assembly
FoundationaLLM.SemanticKernel.Core.dll

Implements a global exception handler for the Semantic Kernel API.

public class SemanticKernelExceptionHandler : IExceptionHandler
Inheritance
SemanticKernelExceptionHandler
Implements
Inherited Members
Extension Methods

Constructors

SemanticKernelExceptionHandler(ILogger<SemanticKernelExceptionHandler>)

Implements a global exception handler for the Semantic Kernel API.

public SemanticKernelExceptionHandler(ILogger<SemanticKernelExceptionHandler> logger)

Parameters

logger ILogger<SemanticKernelExceptionHandler>

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 HttpContext

The HttpContext for the request.

exception Exception

The unhandled exception.

cancellationToken CancellationToken

The cancellation token.

Returns

ValueTask<bool>

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.