Search Results for

    Show / Hide Table of Contents

    Class ExceptionHandlerExtensions

    extensions for global exception handling

    Inheritance
    System.Object
    ExceptionHandlerExtensions
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: FastEndpoints
    Assembly: FastEndpoints.dll
    Syntax
    public static class ExceptionHandlerExtensions

    Methods

    UseDefaultExceptionHandler(IApplicationBuilder, ILogger, Boolean)

    registers the default global exception handler which will log the exceptions on the server and return a user-friendly json response to the client when unhandled exceptions occur. TIP: when using this exception handler, you may want to turn off the asp.net core exception middleware logging to avoid duplication like so:

    "Logging": { "LogLevel": { "Default": "Warning", "Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware": "None" } }
    Declaration
    public static IApplicationBuilder UseDefaultExceptionHandler(this IApplicationBuilder app, ILogger logger = null, bool logStructuredException = false)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Builder.IApplicationBuilder app
    Microsoft.Extensions.Logging.ILogger logger

    an optional logger instance

    System.Boolean logStructuredException

    set to true if you'd like to log the error in a structured manner

    Returns
    Type Description
    Microsoft.AspNetCore.Builder.IApplicationBuilder
    In This Article
    Back to top Developed by Đĵ ΝιΓΞΗΛψΚ and contributors / Licensed under MIT / Website generated by DocFX