29 lines
715 B
C#
29 lines
715 B
C#
|
|
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);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|