ZhiYeJianKang_PeiXun/Song.ViewData/VExcept.cs
2025-02-20 15:41:53 +08:00

47 lines
1.2 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Song.ViewData
{
/// <summary>
/// 异常处理
/// </summary>
public class VExcept : System.Exception
{
/// <summary>
/// 状态码
/// </summary>
public int State { get; set; }
private VExcept(string message, int state) : base(message)
{
this.State = state;
}
/// <summary>
/// 校验类实始状态码为10000
/// </summary>
/// <param name="msg"></param>
/// <param name="state"></param>
/// <returns></returns>
public static VExcept Verify(string msg, int state)
{
VExcept we = new VExcept(msg, state);
we.State = 1000 + state;
return we;
}
/// <summary>
/// 系统类错误
/// </summary>
/// <param name="msg"></param>
/// <param name="state"></param>
/// <returns></returns>
public static VExcept System(string msg, int state)
{
return new VExcept(msg, 9000 + state);
}
}
}