using System;

namespace VCommon.VApplication
{
    /// <summary> 用于身份验证或访问控制, 向用户展示的信息 </summary>
    public class VApplicationAuthException : Exception
    {
        public AuthReason Reason => Data["Reason"] as AuthReason? ?? AuthReason.AuthRequired;

        public VApplicationAuthException(string message, AuthReason reason) : base(message)
        {
            Data["Reason"] = reason;
        }
    }

    public enum AuthReason
    {
        //0 表示无效值

        AuthRequired = 1,

        AccessDenied = 2,
    }
}
