From 1c4426810c71eead57084be8a18ade8d314dd8c4 Mon Sep 17 00:00:00 2001
From: patrick <patrick.xu@broconcentric.com>
Date: 星期二, 10 十二月 2019 14:24:31 +0800
Subject: [PATCH] 1. 重构项目

---
 src/Bro.Common.Model/Helper/ExceptionHelper.cs |   40 ++++++++++++++--------------------------
 1 files changed, 14 insertions(+), 26 deletions(-)

diff --git a/src/Bro.Common.Model/Helper/ExceptionHelper.cs b/src/Bro.Common.Model/Helper/ExceptionHelper.cs
index db85703..87763af 100644
--- a/src/Bro.Common.Model/Helper/ExceptionHelper.cs
+++ b/src/Bro.Common.Model/Helper/ExceptionHelper.cs
@@ -8,8 +8,17 @@
 
 namespace Bro.Common.Helper
 {
+    public enum ExceptionLevel
+    {
+        Info = 0,
+        Warning = 1,
+        Fatal = 2,
+    }
+
     public class ProcessException : Exception
     {
+        public ExceptionLevel Level { get; set; } = ExceptionLevel.Warning;
+
         public static Action<DateTime, string, string> OnExceptionNotice;
 
         //PubSubCenter pubSub = PubSubCenter.GetInstance();
@@ -38,9 +47,11 @@
         {
         }
 
-        public ProcessException(Exception ex)
+        public ProcessException(Exception ex, ExceptionLevel lvl = ExceptionLevel.Warning)
         {
             OriginalException = ex;
+            Level = lvl;
+
             ExceptionNotice();
         }
 
@@ -50,9 +61,10 @@
         //    PositionIndex = positionIndex;
         //}
 
-        public ProcessException(string error, Exception ex = null) : base(error, ex)
+        public ProcessException(string error, ExceptionLevel lvl = ExceptionLevel.Warning, Exception ex = null) : base(error, ex)
         {
             ErrorCode = error;
+            Level = lvl;
             OriginalException = ex;
 
             ExceptionNotice();
@@ -74,29 +86,5 @@
             //pubSub.Publish(PubTag.ExceptionUpdate.ToString(), ErrorCode, OriginalException, true);
             OnExceptionNotice?.Invoke(DateTime.Now, ErrorCode, OriginalException?.GetExceptionMessage());
         }
-    }
-
-    public class Level3Exception : ProcessException
-    {
-        public Level3Exception() : base() { }
-
-        public Level3Exception(string error, Exception ex) : base(error, ex) { }
-    }
-
-    /// <summary>
-    /// 鏉ユ枡妫�娴嬪紓甯�
-    /// </summary>
-    public class IncomingMaterialException : ProcessException
-    {
-        public IncomingMaterialException() : base() { }
-
-        public IncomingMaterialException(string error, Exception ex) : base(error, ex) { }
-    }
-
-    public class BarcodeScanFailureException : ProcessException
-    {
-        public BarcodeScanFailureException() : base() { }
-
-        public BarcodeScanFailureException(string msg, Exception ex) : base(msg, ex) { }
     }
 }

--
Gitblit v1.8.0