예제 #1
0
        public ApplicationMessage GetMessage(BussinessException bex)
        {
            var appMessage = new ApplicationMessage();

            appMessage.Message = "Message not found!";

            if (messages.ContainsKey(bex.ExceptionId))
            {
                appMessage = messages[bex.ExceptionId];
            }

            return(appMessage);
        }
예제 #2
0
        public Message GetMessage(BussinessException bex)
        {
            var appMessage = new Message();

            appMessage.descripsion = "Message not found!";

            if (messages.ContainsKey(bex.ExceptionId))
            {
                appMessage = messages[bex.ExceptionId];
            }

            return(appMessage);
        }
예제 #3
0
        public void Process(Exception ex)
        {
            var bex = new BussinessException();

            if (ex.GetType() == typeof(BussinessException))
            {
                bex = (BussinessException)ex;
            }
            else
            {
                bex = new BussinessException(0, ex);
            }

            ProcessBussinesException(bex);
        }
예제 #4
0
        public void Process(Exception ex)
        {
            var bex = new BussinessException();


            if (ex.GetType() == typeof(BussinessException))
            {
                bex = (BussinessException)ex;
                bex.ExceptionDetails = GetMessage(bex).Message;
            }
            else
            {
                bex = new BussinessException(0, ex);
            }

            ProcessBussinesException(bex);
        }
예제 #5
0
        private void ProcessBussinesException(BussinessException bex)
        {
            var today   = DateTime.Now.ToString("yyyyMMdd_hh");
            var logName = PATH + today + "_" + "log.txt";

            var message = bex.ExceptionDetails + "\n" + bex.StackTrace + "\n";

            //if (bex.InnerException!=null)
            //    message += bex.InnerException.Message + "\n" + bex.InnerException.StackTrace;

            using (StreamWriter w = File.AppendText(logName))
            {
                Log(message, w);
            }

            bex.AppMessage = GetMessage(bex);

            throw bex;
        }