Class TransactionExceptionMapper

java.lang.Object
io.leandev.appfuse.error.mapper.TransactionExceptionMapper
All Implemented Interfaces:
ExceptionMapper<org.springframework.transaction.TransactionSystemException>

public class TransactionExceptionMapper extends Object implements ExceptionMapper<org.springframework.transaction.TransactionSystemException>

Spring Transaction 異常映射器

處理事務提交時的驗證失敗,轉換為 RFC 7807 ProblemDetail。

  • Constructor Details

    • TransactionExceptionMapper

      public TransactionExceptionMapper()
  • Method Details

    • supports

      public boolean supports(Exception exception)
      Description copied from interface: ExceptionMapper
      檢查此 Mapper 是否支援給定的異常
      Specified by:
      supports in interface ExceptionMapper<org.springframework.transaction.TransactionSystemException>
      Parameters:
      exception - 待檢查的異常
      Returns:
      true 如果支援,否則 false
    • map

      public org.springframework.http.ProblemDetail map(org.springframework.transaction.TransactionSystemException ex)
      Description copied from interface: ExceptionMapper
      將異常轉換為 ProblemDetail (RFC 7807)
      Specified by:
      map in interface ExceptionMapper<org.springframework.transaction.TransactionSystemException>
      Parameters:
      ex - 待轉換的異常
      Returns:
      ProblemDetail 錯誤回應物件