Skip to content

Calling 'AddJsonApi' bypass all the exception handler middlewares #501

Closed
@mabead

Description

@mabead

Description

Before using JsonApiDotNetCore, I had an ASP.NET Core middleware that had the responsibility to reformat all exceptions that occured in my controllers. This middleware was almost identical to this one.

As soon as I started to use JsonApiDotNetCore by calling AddJsonApi, my middleware stopped working. This is because AddJsonApi registers an exception filter:

options.Filters.Add(typeof(JsonApiExceptionFilter));

This exception filter handles all exceptions. My middleware is therefore unable to detect the exception.

Is there a way to disable this exception filter or to limit this exception filter to the routes that to use JSONAPI? My routes that don't use JSONAPI should still use my exception middleware.

Environment

  • JsonApiDotNetCore Version: 3.1.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions