| | |
| | | |
| | | 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(); |
| | |
| | | { |
| | | } |
| | | |
| | | public ProcessException(Exception ex) |
| | | public ProcessException(Exception ex, ExceptionLevel lvl = ExceptionLevel.Warning) |
| | | { |
| | | OriginalException = ex; |
| | | Level = lvl; |
| | | |
| | | ExceptionNotice(); |
| | | } |
| | | |
| | |
| | | // PositionIndex = positionIndex; |
| | | //} |
| | | |
| | | public ProcessException(string error, Exception ex) : base(error, ex) |
| | | public ProcessException(string error, ExceptionLevel lvl = ExceptionLevel.Warning, Exception ex = null) : base(error, ex) |
| | | { |
| | | ErrorCode = error; |
| | | Level = lvl; |
| | | OriginalException = ex; |
| | | |
| | | ExceptionNotice(); |
| | |
| | | //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) { } |
| | | } |
| | | } |