Class ConstraintException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
io.leandev.appfuse.exception.ApplicationException
io.leandev.appfuse.exception.ConstraintException
- All Implemented Interfaces:
Serializable
約束違規例外,表示輸入資料未通過驗證約束。
此例外用於封裝資料驗證失敗的詳細資訊,可包含多個 Violation 物件,
每個違規物件描述一個欄位的驗證錯誤。
對應 HTTP 狀態碼 400 (Bad Request) 或 422 (Unprocessable Entity)。
- See Also:
-
Constructor Summary
ConstructorsConstructorDescription建立使用預設訊息的約束例外。ConstraintException(Violation violation) 建立包含單一違規的約束例外。ConstraintException(Violation violation, String message, Object... parameters) 建立包含單一違規和自訂訊息的約束例外。ConstraintException(Violation violation, Throwable cause) 建立包含單一違規和原因的約束例外。ConstraintException(String message, Object... params) 建立指定訊息的約束例外。ConstraintException(String message, Throwable cause, Object... params) 建立指定訊息和原因的約束例外。ConstraintException(Throwable cause) 建立包裝原始例外的約束例外。ConstraintException(Set<Violation> violations) 建立包含多個違規的約束例外。ConstraintException(Set<Violation> violations, String message, Object... parameters) 建立包含多個違規和自訂訊息的約束例外。ConstraintException(Set<Violation> violations, String message, Throwable cause, Object... parameters) 建立包含多個違規、自訂訊息和原因的約束例外。ConstraintException(Set<Violation> violations, Throwable cause) 建立包含多個違規和原因的約束例外。 -
Method Summary
Methods inherited from class ApplicationException
getMessageMethods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
Constructor Details
-
ConstraintException
public ConstraintException()建立使用預設訊息的約束例外。 -
ConstraintException
-
ConstraintException
-
ConstraintException
-
ConstraintException
-
ConstraintException
-
ConstraintException
-
ConstraintException
-
ConstraintException
-
ConstraintException
-
ConstraintException
-
-
Method Details
-
getViolations
-
toString
Description copied from class:ApplicationException覆寫 toString(),提供完整的異常描述- Overrides:
toStringin classApplicationException- Returns:
- 異常描述字串
-