using NCC.Dependency;
using System;
namespace NCC.FriendlyException
{
///
/// 异常复写特性
///
[SuppressSniffer, AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)]
public sealed class IfExceptionAttribute : Attribute
{
///
/// 默认构造函数
///
public IfExceptionAttribute()
{
}
///
/// 构造函数
///
/// 错误编码
/// 格式化参数
public IfExceptionAttribute(object errorCode, params object[] args)
{
ErrorCode = errorCode;
Args = args;
}
///
/// 捕获特定异常类型异常(用于全局异常捕获)
///
///
public IfExceptionAttribute(Type exceptionType)
{
ExceptionType = exceptionType;
}
///
/// 错误编码
///
public object ErrorCode { get; set; }
///
/// 异常类型
///
public Type ExceptionType { get; set; }
///
/// 错误消息
///
public string ErrorMessage { get; set; }
///
/// 格式化参数
///
public object[] Args { get; set; }
}
}