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.
 
 
 

58 lines
1.2 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Wood.Util
{
public class SystemMessageException : Exception
{
// 构造函数:无参构造函数
public SystemMessageException()
: base()
{
}
// 构造函数:接受消息字符串
public SystemMessageException(string message)
: base(message)
{
}
// 构造函数:接受消息字符串和内部异常对象
public SystemMessageException(string message, Exception innerException)
: base(message, innerException)
{
}
// 可选:添加自定义属性或方法
public string ErrorCode { get; set; } = "-1";
public SystemMessageException(string message, string errorCode)
: base(message)
{
ErrorCode = errorCode;
}
public SystemMessageException(string message, string errorCode, Exception innerException)
: base(message, innerException)
{
ErrorCode = errorCode;
}
}
public static class Oops
{
public static SystemMessageException Oh(string message)
{
return new SystemMessageException(message);
}
public static SystemMessageException Oh(string message, string code)
{
return new SystemMessageException(message, code);
}
}
}