/// <summary> /// 处理系统错误变量 /// </summary> /// <param name="err">系统错误类型号</param> /// <returns>返回与错误号相关的字符串</returns> public string handleSystemError(SystemErrorType err) { switch (err) { case SystemErrorType.enumOK: return("操作完成"); case SystemErrorType.enumArcObjectHandleError: return("ArcGIS控件操作失败"); case SystemErrorType.enumArcOjectLoadFail: return("ArcGIS控件加载失败"); case SystemErrorType.enumDataIsIllegal: return("处理的数据不合法或不服和要求"); case SystemErrorType.enumFileNotExist: return("文件不存在或不能被读写等操作"); case SystemErrorType.enumFilePathIsNull: return("文件路径不能为空"); case SystemErrorType.enumTypeNotExist: return("选取的类型不存在"); case SystemErrorType.enumUnknowError: return("遇到未知的异常"); default: return("系统错误类型不存在"); } }
private void UnwrapException(Exception e) { var flatten = FlattenException(e); foreach (var ie in flatten) { SystemErrorType += ie.GetType().FullName + Environment.NewLine; SystemErrorMessage += ie.Message + Environment.NewLine; } SystemErrorType = SystemErrorType.TrimEnd(); SystemErrorMessage = SystemErrorMessage.TrimEnd(); SystemErrorStack = e.StackTrace; }
/// <summary> /// 内联消息构造 /// </summary> /// <param name="message"> 消息 </param> /// <param name="innerException"> 内联消息 </param> /// <param name="errtype"> 异常类型 </param> /// <param name="innermessage"> 内部扩展消息 </param> public AgebullSystemException(string message, SystemErrorType errtype, string innermessage, Exception innerException) : base(message, innerException) { ErrorType = errtype; InnerMessage = innermessage; }
/// <summary> /// 内联消息构造 /// </summary> /// <param name="message"> 消息 </param> /// <param name="innerException"> 内联消息 </param> public AgebullSystemException(string message, Exception innerException) : base(message, innerException) { ErrorType = SystemErrorType.UnknowError; }
public SystemError(string message, SystemErrorType type) { Message = message; Type = type; }