Exception Handling Standards -The exception Exception should never been thrown. Always Subclass Exception and throw the subclassed Classes.

Topics: Exception Handling Application Block, General discussion
Feb 5, 2015 at 5:11 PM
Hi,

In the current project my exception handling implementation is as follows :

Exception Handling Layer wise :

DL layer :

catch (Exception ex)
        {
            bool rethrow = ExceptionPolicy.HandleException(ex, "Ui Policy");
            if (rethrow)
            {
                throw;
            }
        }
BL Layer

catch (Exception ex)
        {
            bool rethrow = ExceptionPolicy.HandleException(ex, "Ui Policy");
            if (rethrow)
            {
                throw;
            }
        }
UI Layer

catch (Exception ex)
        {
            bool rethrow = ExceptionPolicy.HandleException(ex, "Ui Policy");
            if (rethrow)
            {
                Response.Redirect("ErrorPage.aspx", false);
            }
        }
We have a tool to check the standards. And tool output is as follows :

The exception Exception should never been thrown. Always Subclass Exception and throw the subclassed Classes.

I need suggestions on how to implement the same according to standards.