You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

56 lines
1.7 KiB

using System;
using System.ComponentModel.DataAnnotations;
using System.Text;
using ChangkeTec.SDMS.Model.Enums;
using CK.SCP.Utils;
namespace ChangkeTec.SDMS.Model
{
[Serializable] //声明为可序列化的 因为要写入文件中
public class CktException : ApplicationException //由用户程序引发,用于派生自定义的异常类型
{
private const string SP = ";";
/// <summary>
/// 默认构造函数
/// </summary>
public CktException()
{
}
public CktException(EnumErrorCode code, string indexString = null, string message = null,
Exception inner = null)
: base(message, inner)
{
Code = code;
IndexString = indexString;
Ex = inner;
}
// private ResultCode _code;
// private string _indexString;
public EnumErrorCode Code { get; set; }
[StringLength(50)]
public string IndexString { get; set; }
public Exception Ex { get; set; }
// public WmsException(System.Runtime.Serialization.SerializationInfo info,
// System.Runtime.Serialization.StreamingContext context) : base(info, context)
// {
// _indexString = info.GetString(IndexString);
// }
public override string ToString()
{
var sb = new StringBuilder();
sb.Append(EnumHelper.GetDesc(Code) + SP);
sb.Append(IndexString ?? "" + SP);
if (!string.IsNullOrEmpty(Message))
sb.Append(Message ?? "" + SP);
if (Ex != null)
sb.Append(Ex);
return sb.ToString();
}
}
}