- [Serializable]
- public class PFTException : Exception
- {
- public PFTException()
- {
- }
-
- public PFTException(string message)
- : base(message)
- {
- PFTLog.Error(message, () => { });
- }
-
- public PFTException(string messageFormat, params object[] args)
- : base(string.Format(messageFormat, args))
- {
- PFTLog.Error(string.Format(messageFormat, args), () => { });
- }
-
- public PFTException(string message, Exception innerException)
- : base(message, innerException)
- {
- //只记录最原始的Exception信息
- if (!(innerException is PFTException))
- {
- PFTLog.Error(message, innerException, () => { });
- }
- }
-
-
- /// <summary>
- /// 实现ISerialization接口所需要的反序列化构造函数。
- /// </summary>
- /// <param name="info"></param>
- /// <param name="context"></param>
- private PFTException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- // stringInfo = info.GetString("StringInfo");
- }
-
- /// <summary>
- /// 重写GetObjectData方法。如果添加了自定义字段,一定要重写基类GetObjectData方法的实现
- /// </summary>
- /// <param name="info"></param>
- /// <param name="context"></param>
- public override void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- // 序列化自定义数据成员
- //info.AddValue("StringInfo", stringInfo);
-
- // 调用基类方法,序列化它的成员
- base.GetObjectData(info, context);
- }
-
- }