Create Custom Exception Filter in ASP.NET Core
In my previous article I explained how errors in an ASP.NET Core web application can be dealt with using middleware. I also mentioned that time that you can also use exception filters to handle errors. In this article I will explain how to do just that. In ASP.NET MVC 5 you used the [HandleError] attribute and OnException() controller method to deal with exceptions that arise in the actions of a controller. In ASP.NET Core the process is bit different but the overall concept is still the same.
http://www.binaryintellect.net/articles/5df6e275-1148-45a1-a8b3-0ba2c7c9cea1.aspx