Interface ErrorResolver

All Known Implementing Classes:
FallbackErrorResolver, WebClientBadRequestExceptionErrorResolver, WebClientExceptionErrorResolver

public interface ErrorResolver
Implementations handle mapping specific exceptions to readable error messages. Implementation notes:
  1. The Throwable supplied is always the most derived throwable, so the implementation does not need to traverse the exception hierarchy.
  2. Only the first error resolver that returns true from canResolve(Throwable) will handle an error. To ensure that custom implementations are first, consider using the Order annotation.
  3. Framework implementations are ordered with Ordered.LOWEST_PRECEDENCE or close to lowest precedence so that they may be easily superseded by custom implementations, though they may also be extended and overridden just like any Broadleaf component.
  • Method Details

    • canResolve

      boolean canResolve(Throwable t)
      Returns true if this resolver can map the exception to a readable error message.
      Parameters:
      t - the exception
      Returns:
      true if this resolver can map the exception to a readable error message
    • resolve

      Maps the exception to a readable error message. The supplied error object will be initialized with DataExchangeError.getPath() populated. Implementations should handle populating any additional information that will be returned.

      It is possible for implementations to return a different error object than the one supplied. If this is needed, the returned error object should have the same path as the supplied error object.

      Parameters:
      error - The error object to populate.
      t - the exception
      Returns:
      a readable error message