Interface ExceptionMapper<T extends Exception>

Type Parameters:
T - 支援的異常類型
All Known Implementing Classes:
ApplicationExceptionMapper, DataAccessExceptionMapper, HttpMessageConversionExceptionMapper, LockoutExceptionMapper, TransactionExceptionMapper, ValidationExceptionMapper

public interface ExceptionMapper<T extends Exception>

異常映射策略接口

負責將特定類型的異常轉換為 RFC 7807 ProblemDetail。

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.http.ProblemDetail
    map(T exception)
    將異常轉換為 ProblemDetail (RFC 7807)
    boolean
    supports(Exception exception)
    檢查此 Mapper 是否支援給定的異常
  • Method Details

    • supports

      boolean supports(Exception exception)
      檢查此 Mapper 是否支援給定的異常
      Parameters:
      exception - 待檢查的異常
      Returns:
      true 如果支援,否則 false
    • map

      org.springframework.http.ProblemDetail map(T exception)
      將異常轉換為 ProblemDetail (RFC 7807)
      Parameters:
      exception - 待轉換的異常
      Returns:
      ProblemDetail 錯誤回應物件