MVC Error handling using Action Filters

301 Views Asked by At

I would like to know best practice to handle exceptions.

I have 3 types of exception flows

1) Warnings: - In this I am required to display the partial data received from the service and also the error code/ message. 2) Business errors: - In this no data just the error code is received but I want to display the view with all the controls (e.g. dropdown) and the error message. 3) System failure errors: - In this scenario I would like to redirect to custom error page.

I am using Using ASP.NET MVC and lang is C#

1

There are 1 best solutions below

0
On

It sounds like (1) and (2) probably shouldn't be exceptions. If you can easily handle the error and present a page to the user and let them continue, I wouldn't use exceptions. These sound more like data or validation issues which could be handled in code without exceptions.