2025-01-13 21:06:59 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
2025-01-14 14:51:07 +08:00
|
|
|
|
namespace YD_XinWei.Commons.Exceptions
|
2025-01-13 21:06:59 +08:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 通过业务异常类
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class BizException : Exception
|
|
|
|
|
{
|
2025-01-14 14:51:07 +08:00
|
|
|
|
public string ErrorCode { get; } // 业务异常编号
|
|
|
|
|
public string ErrorMsg { get; }// 业务异常信息
|
|
|
|
|
|
|
|
|
|
public bool Success { get; set; } = false;
|
2025-01-13 21:06:59 +08:00
|
|
|
|
|
|
|
|
|
public IDictionary<string, object> Infos { set; get; } // 业务异常详细信息
|
|
|
|
|
|
2025-01-14 14:51:07 +08:00
|
|
|
|
public BizException(string ErrorCode, string ErrorMsg) : base(ErrorMsg)
|
2025-01-13 21:06:59 +08:00
|
|
|
|
{
|
2025-01-14 14:51:07 +08:00
|
|
|
|
ErrorCode = ErrorCode;
|
|
|
|
|
ErrorMsg = ErrorMsg;
|
2025-01-13 21:06:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
2025-01-14 14:51:07 +08:00
|
|
|
|
public BizException(string ErrorCode, string ErrorMsg, Exception e) : base(ErrorMsg, e)
|
2025-01-13 21:06:59 +08:00
|
|
|
|
{
|
2025-01-14 14:51:07 +08:00
|
|
|
|
ErrorCode = ErrorCode;
|
|
|
|
|
ErrorMsg = ErrorMsg;
|
2025-01-13 21:06:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
2025-01-14 14:51:07 +08:00
|
|
|
|
public BizException(string ErrorMsg) : base(ErrorMsg)
|
2025-01-13 21:06:59 +08:00
|
|
|
|
{
|
2025-01-14 14:51:07 +08:00
|
|
|
|
ErrorCode = "-1";
|
|
|
|
|
ErrorMsg = ErrorMsg;
|
2025-01-13 21:06:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
2025-01-14 14:51:07 +08:00
|
|
|
|
public BizException(string ErrorMsg, Exception e) : base(ErrorMsg, e)
|
2025-01-13 21:06:59 +08:00
|
|
|
|
{
|
2025-01-14 14:51:07 +08:00
|
|
|
|
ErrorCode = "-1";
|
|
|
|
|
ErrorMsg = ErrorMsg;
|
2025-01-13 21:06:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public BizException(Exception e)
|
|
|
|
|
{
|
2025-01-14 14:51:07 +08:00
|
|
|
|
ErrorCode = "-1";
|
|
|
|
|
ErrorMsg = e.Message;
|
2025-01-13 21:06:59 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|