public override bool HandleException(ref Exception exception, ExceptionLayer layer)
        {
            bool reThrow = false;

            switch (layer)
            {
                case ExceptionLayer.Data:

                    if (exception is SqlException)
                    {
                        SqlException changedType = exception as SqlException;

                        if (changedType.ErrorCode > 500000)
                        {
                            reThrow = ExceptionPolicy.HandleException(exception, "DataAccessCustomException");
                            exception = new KDataAccessCustomException(exception.Message);
                        }
                        else
                        {
                            reThrow = ExceptionPolicy.HandleException(exception, "DataAccessException");

                        }
                    }
                    else
                    {
                        reThrow = ExceptionPolicy.HandleException(exception, "DataAccessException");

                    }

                    break;

                case ExceptionLayer.Business:

                    reThrow = ExceptionPolicy.HandleException(exception, "BusinessException");

                    break;

                case ExceptionLayer.Presentation:

                    reThrow = ExceptionPolicy.HandleException(exception, "PresentaionException");

                    break;
            }

            return reThrow;
        }
Example #2
0
 public abstract bool HandleException(ref Exception exception, ExceptionLayer layer);