51 lines
1.2 KiB
C#
51 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace YuanXuan.IM.Common.Exceptions
|
|
{
|
|
/// <summary>
|
|
/// 业务异常
|
|
/// </summary>
|
|
public class BusinessException : Exception
|
|
{
|
|
|
|
public BusinessExceptionCode ErrorCode { get; private set; }
|
|
public object BussinessExceptionData { get; private set; }
|
|
|
|
public BusinessException(string message, object friendlyData = null, BusinessExceptionCode errorCode = BusinessExceptionCode.BussinessError) : base(message)
|
|
{
|
|
ErrorCode = errorCode;
|
|
BussinessExceptionData = friendlyData;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 业务异常码
|
|
/// </summary>
|
|
public enum BusinessExceptionCode
|
|
{
|
|
/// <summary>
|
|
/// 业务异常码
|
|
/// </summary>
|
|
BussinessError = 1000,
|
|
|
|
/// <summary>
|
|
/// 程序异常码
|
|
/// </summary>
|
|
AppError = 500,
|
|
|
|
/// <summary>
|
|
/// 访问令牌异常码
|
|
/// </summary>
|
|
AccessTokenError = 401,
|
|
|
|
/// <summary>
|
|
/// 访问令牌被顶号异常码
|
|
/// </summary>
|
|
AccessTokenTopNumberError = 402,
|
|
}
|
|
}
|