Class DefaultBatchItemErrorHandler

java.lang.Object
com.broadleafcommerce.dataexchange.service.error.DefaultBatchItemErrorHandler
All Implemented Interfaces:
BatchItemErrorHandler

public class DefaultBatchItemErrorHandler extends Object implements BatchItemErrorHandler
  • Constructor Details

    • DefaultBatchItemErrorHandler

      public DefaultBatchItemErrorHandler(@NonNull @NonNull List<ErrorResolver> errorResolvers, com.broadleafcommerce.common.extension.TypeFactory typeFactory, DataExchangeErrorProperties properties)
  • Method Details

    • handleErrors

      public void handleErrors(List<ExchangeObject> exchangeObjects, BatchContext<?> batchContext)
      Handles errors for the given exchange objects. It is assumed that all objects in the list have errors.
      Specified by:
      handleErrors in interface BatchItemErrorHandler
      Parameters:
      exchangeObjects - the exchange objects
    • handleGlobalError

      public DataExchangeGlobalException handleGlobalError(Throwable throwable, BatchContext<?> batchContext)
      Description copied from interface: BatchItemErrorHandler
      Handles an unrecoverable error that occurred during processing of a batch of exchange objects. This is called when an error occurs outside the processing of individual exchange objects.
      Specified by:
      handleGlobalError in interface BatchItemErrorHandler
      Parameters:
      throwable - the error that occurred
      batchContext - the batch context
      Returns:
      An exception to be thrown.
    • sortErrors

      protected void sortErrors(BatchContext<?> batchContext)
      Errors are not guaranteed to be in any particular order, so we're just making an attempt to sort them here before returning. This should make it a little easier to read the response.
      Parameters:
      batchContext - the batch context
    • getRootCause

      protected Throwable getRootCause(Throwable t)
    • initError

      protected DataExchangeError initError(ExchangeObject exchangeObject, Throwable throwable)