Search code examples
asp.net-mvcasp.net-coreasp.net-mvc-filters

aspnetcore multiple global exception filters issue


I read this https://learn.microsoft.com/en-us/aspnet/core/mvc/controllers/filters?view=aspnetcore-3.1#filter-scopes-and-order-of-execution, and it seems to indicate that there is no explicit ordering on how the exception filters are executed (as they are of the same scope).

I have 3 exception filters: 1 is a generic 3rd party exception filter, and 2 are specific exception filters.

How could I make it so that when a specific exception is handled by my filters, the generic one should not handle it anymore?


Solution

  • Nvm, there is an override on Add() that allows for specific ordering; ouch!