How to Retrieve All Errors from Every Stage of a Map/Reduce Script in the Summarize Stage

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;
                });

Leave a comment

Your email address will not be published. Required fields are marked *