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.
 
 
 
 
 

50 lines
1.6 KiB

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