Class LockoutException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
io.leandev.appfuse.exception.ApplicationException
io.leandev.appfuse.exception.LockoutException
- All Implemented Interfaces:
Serializable
帳號鎖定異常
當使用者因連續登入失敗而被鎖定時拋出此異常。
繼承自 ApplicationException,遵循統一的異常處理架構。
設計理念:
- 與其他 ApplicationException 子類保持一致的設計
- 完全依賴 format 和 params 傳遞訊息
- 不攜帶特定業務欄位,提高彈性
使用場景:
- 登入前檢測到帳號已鎖定
- 登入失敗達到閾值並觸發鎖定
使用範例:
// 使用位置參數格式
String format = "Too many failed login attempts (${0}). Account is locked for ${1} minutes.";
throw new LockoutException(format, failureCount, remainingMinutes);
處理流程:
Service Layer: throw new LockoutException(format, params...)
↓
StandardRestExceptionHandler: 捕獲異常
↓
LockoutExceptionMapper: 映射為 LockoutErrorResponse
↓
HTTP Response: 統一格式的 JSON 回應
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionLockoutException(String format, Object... params) 建構帳號鎖定異常LockoutException(String format, Throwable cause, Object... params) 建構帳號鎖定異常(帶原因) -
Method Summary
Methods inherited from class ApplicationException
getMessage, toStringMethods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
Constructor Details
-
LockoutException
-
LockoutException
-