Class DataAccessExceptionMapper
java.lang.Object
io.leandev.appfuse.error.mapper.DataAccessExceptionMapper
- All Implemented Interfaces:
ExceptionMapper<org.springframework.dao.DataAccessException>
public class DataAccessExceptionMapper
extends Object
implements ExceptionMapper<org.springframework.dao.DataAccessException>
Spring Data 異常映射器
處理 JPA/JDBC 資料庫操作異常,轉換為 RFC 7807 ProblemDetail。
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
DataAccessExceptionMapper
public DataAccessExceptionMapper()
-
-
Method Details
-
supports
Description copied from interface:ExceptionMapper檢查此 Mapper 是否支援給定的異常- Specified by:
supportsin interfaceExceptionMapper<org.springframework.dao.DataAccessException>- Parameters:
exception- 待檢查的異常- Returns:
- true 如果支援,否則 false
-
map
public org.springframework.http.ProblemDetail map(org.springframework.dao.DataAccessException ex) Description copied from interface:ExceptionMapper將異常轉換為 ProblemDetail (RFC 7807)- Specified by:
mapin interfaceExceptionMapper<org.springframework.dao.DataAccessException>- Parameters:
ex- 待轉換的異常- Returns:
- ProblemDetail 錯誤回應物件
-