Class AuthenticationException

All Implemented Interfaces:
Serializable

public class AuthenticationException extends RuntimeException
身份验证异常

当用户身份验证失败时抛出此异常,例如: 1. 用户未登录 2. Token无效或已过期 3. 用户名或密码错误

该异常包含一个status字段,用于标识验证失败的状态码

Author:
Kerbores(kerbores@riemann.tech)
See Also:
  • Constructor Details

    • AuthenticationException

      public AuthenticationException()
      构造默认的身份验证异常

      使用默认状态码"DEFAULT"

    • AuthenticationException

      public AuthenticationException(String message)
      构造带消息的身份验证异常

      使用默认状态码"DEFAULT"

      Parameters:
      message - 异常消息,描述验证失败的原因
    • AuthenticationException

      public AuthenticationException(String message, String status)
      构造带消息和状态码的身份验证异常
      Parameters:
      message - 异常消息,描述验证失败的原因
      status - 状态码,用于标识具体的验证失败类型
  • Method Details

    • getStatus

      public String getStatus()
      获取身份验证失败的状态码
      Returns:
      状态码