using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VideoAnalysisCore.Common
{
///
/// 异常抛出的拓展类
///
public class Oh
{
///
/// 抛出 异常
///
///
///
///
public static void Error(string message, int code = 500)
{
throw new OhException(message, code);
}
///
/// 抛出 异常
///
///
///
///
public static T Error(string message, int code = 500)
{
throw new OhException(message, code);
}
///
/// 抛出 模型校验异常
///
///
///
///
public static void ModelError(string message, int code = 400)
{
throw new OhException(message, code);
}
///
/// 抛出 模型校验异常
///
///
///
///
public static void ToeknError(string message, int code = 401)
{
throw new OhException(message, code);
}
}
public class OhException : Exception
{
///
/// 错误码
///
public virtual int Code { get; }
public OhException(string message, int code = -1) : base(message)
{
Code = code;
}
}
}