Table of Contents

Class ExceptionHandler

Namespace
JsonApiDotNetCore.Middleware
Assembly
JsonApiDotNetCore.dll

Central place to handle all exceptions, such as log them and translate into error response.

[PublicAPI]
public class ExceptionHandler : IExceptionHandler
Inheritance
ExceptionHandler
Implements
Inherited Members

Constructors

ExceptionHandler(ILoggerFactory, IJsonApiOptions)

public ExceptionHandler(ILoggerFactory loggerFactory, IJsonApiOptions options)

Parameters

loggerFactory ILoggerFactory
options IJsonApiOptions

Methods

CreateErrorResponse(Exception)

protected virtual IReadOnlyList<ErrorObject> CreateErrorResponse(Exception exception)

Parameters

exception Exception

Returns

IReadOnlyList<ErrorObject>

GetLogLevel(Exception)

protected virtual LogLevel GetLogLevel(Exception exception)

Parameters

exception Exception

Returns

LogLevel

GetLogMessage(Exception)

protected virtual string GetLogMessage(Exception exception)

Parameters

exception Exception

Returns

string

HandleException(Exception)

public IReadOnlyList<ErrorObject> HandleException(Exception exception)

Parameters

exception Exception

Returns

IReadOnlyList<ErrorObject>