Files
juipnet/Infrastructure/Hncore.Infrastructure/Data/BusinessException.cs

29 lines
715 B
C#
Raw Normal View History

2024-04-10 13:55:27 +08:00
using System;
using Hncore.Infrastructure.WebApi;
namespace Hncore.Infrastructure.Data
{
public class BusinessException : Exception
{
public ResultCode Code { get; } = ResultCode.C_UNKNOWN_ERROR;
public BusinessException(string message) : base(message)
{
}
public BusinessException(ResultCode code, string message = "") : base(message)
{
Code = code;
}
public static void Throw(string message = "")
{
throw new BusinessException(message);
}
public static void Throw(ResultCode code, string message = "")
{
throw new BusinessException(code, message);
}
}
}