To retrieve all the errors that occurred in different stages of a Map/Reduce script during the summarize stage, you can use the following code:
if (summaryContext.inputSummary.error) {
let error = JSON.parse(summaryContext.inputSummary.error);
log.error("Errors in getInputData",error);
}
summaryContext.mapSummary.errors.iterator().each(function (key, error, executionNo) {
error = JSON.parse(error);
log.error("Map error for key: " + key,error);
return true;
});
summaryContext.reduceSummary.errors.iterator().each(function (key, error, executionNo) {
error = JSON.parse(error);
log.error("Reduce error for key: " + key,error);
return true;
});