50 lines
1.3 KiB
C#
Raw Normal View History

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