コード例 #1
0
        public static void HandleException(ExceptionBE log, Exception ex, bool propagate = true)
        {
            // register in database
            ExceptionBL errorModule = new ExceptionBL();

            log.Message = GetMessage(ex);
            log.Type    = PolicyName.ResolvePolicy(log.Class);

            errorModule.Create(log);

            if (log.Type == PolicyName.Business || log.Type == PolicyName.Data)
            {
                if (propagate)
                {
                    throw ex;
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Manejador generico de excepciones
        /// </summary>
        /// <param name="ex">Excepcion a manejar</param>
        /// <param name="policyName">Nombre de la politica a usar</param>
        private static void HandleException(Exception ex, string policyName, bool propagate = true)
        {
            // register in database
            ExceptionBL errorModule = new ExceptionBL();

            errorModule.Create(new ExceptionBE()
            {
                Type    = policyName,
                Class   = "Custom",
                Method  = "Custom",
                Message = GetMessage(ex),
                Source  = ex.Source,
                Stack   = ex.StackTrace,
            });

            if (policyName == PolicyName.Business || policyName == PolicyName.Data)
            {
                if (propagate)
                {
                    throw ex;
                }
            }
        }