using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HuanMeng.DotNetCore.Base
{
///
/// 自定义异常类,用于特定业务场景
/// 该异常被捕获时不会记录日志,适用于普通业务逻辑错误
///
public class CustomException : Exception
{
///
/// 错误参数名
///
public string ParamName { get; }
///
/// 创建自定义异常
///
/// 错误消息
public CustomException(string message) : base(message)
{
ParamName = message;
}
///
/// 创建自定义异常
///
/// 错误消息
/// 参数名
public CustomException(string message, string paramName) : base(message)
{
ParamName = paramName;
}
///
/// 创建自定义异常
///
/// 错误消息
/// 内部异常
public CustomException(string message, Exception innerException) : base(message, innerException)
{
ParamName = message;
}
///
/// 创建自定义异常
///
/// 错误消息
/// 参数名
/// 内部异常
public CustomException(string message, string paramName, Exception innerException) : base(message, innerException)
{
ParamName = paramName;
}
}
}