Class DefaultBatchItemErrorHandler
java.lang.Object
com.broadleafcommerce.dataexchange.service.error.DefaultBatchItemErrorHandler
- All Implemented Interfaces:
BatchItemErrorHandler
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
An exchange object to represent an error that occurred outside the processing of individual exchange objects. -
Constructor Summary
ConstructorsConstructorDescriptionDefaultBatchItemErrorHandler
(@NonNull List<ErrorResolver> errorResolvers, com.broadleafcommerce.common.extension.TypeFactory typeFactory, DataExchangeErrorProperties properties) -
Method Summary
Modifier and TypeMethodDescriptionprotected Throwable
void
handleErrors
(List<ExchangeObject> exchangeObjects, BatchContext<?> batchContext) Handles errors for the given exchange objects.handleGlobalError
(Throwable throwable, BatchContext<?> batchContext) Handles an unrecoverable error that occurred during processing of a batch of exchange objects.protected DataExchangeError
initError
(ExchangeObject exchangeObject, Throwable throwable) 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.
-
Constructor Details
-
DefaultBatchItemErrorHandler
public DefaultBatchItemErrorHandler(@NonNull @NonNull List<ErrorResolver> errorResolvers, com.broadleafcommerce.common.extension.TypeFactory typeFactory, DataExchangeErrorProperties properties)
-
-
Method Details
-
handleErrors
Handles errors for the given exchange objects. It is assumed that all objects in the list have errors.- Specified by:
handleErrors
in interfaceBatchItemErrorHandler
- 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 interfaceBatchItemErrorHandler
- Parameters:
throwable
- the error that occurredbatchContext
- the batch context- Returns:
- An exception to be thrown.
-
sortErrors
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
-
initError
-