Show / Hide Table of Contents

Class SimpleExceptionHandler

An exception handler that writes the message of the exception to the response and returns a 400 status code for expected exceptions or 500 for unexpected ones.

Inheritance
Object
SimpleExceptionHandler
Implements
IExceptionHandler
Namespace: Seltzr.ExceptionHandlers
Assembly: Seltzr.dll
Syntax
C#
public class SimpleExceptionHandler : IExceptionHandler

Constructors

| Improve this Doc View Source

SimpleExceptionHandler(Boolean)

Initializes a new instance of the SimpleExceptionHandler class.

C#
public SimpleExceptionHandler(bool isDevelopment)
Parameters
isDevelopmentBoolean

true if the app is in a development environment, false otherwise

Methods

| Improve this Doc View Source

HandleException(Exception, HttpContext, Boolean)

Handles API exceptions

C#
public virtual Task<bool?> HandleException(Exception exception, HttpContext context, bool hasNext)
Parameters
exceptionException

The exception that was thrown

contextHttpContext

The current request context

hasNextBoolean

true if there is another middleware registered for this route, false otherwise

Returns

Task<Nullable<Boolean>>

true if the request should continue and attempt to use the next middleware registered for this route, false to halt request execution,

C#
null
to continue with the next exception handler.

Implements

IExceptionHandler
  • Improve this Doc
  • View Source
Back to top Generated by DocFX