Esempio n. 1
0
        protected FacadeException HandleException(string category, string source, string errMsg, Exception innerException)
        {
            FacadeException ex = new FacadeException(errMsg, innerException);

            if (LogWriter != null)
            {
                LogWriter.Write(category, source, ex);
            }
            return(ex);
        }
Esempio n. 2
0
        private void AddErrors(ModelStateDictionary modelState, FacadeException exception)
        {
            foreach (var message in exception.Messages)
            {
                modelState.AddModelError("", message);
            }

            foreach (var kvp in exception.PropertyMessages)
            {
                foreach (var message in kvp.Value)
                {
                    modelState.AddModelError($"{_facadePropertyPrefix}{kvp.Key}", message);
                }
            }
        }
Esempio n. 3
0
        protected FacadeException HandleException(string category, string errMsg, Exception innerException, params object[] objs)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(errMsg);
            if (objs != null && objs.Length > 0)
            {
                foreach (object obj in objs)
                {
                    sb.AppendLine(ORMHelper.GetEntityInfoMessage(objs[0]));
                    sb.AppendLine();
                }
            }
            FacadeException ex = new FacadeException(sb.ToString(), innerException);

            if (LogWriter != null)
            {
                LogWriter.Write(category, errMsg, ex);
            }
            return(ex);
        }