mapSummary.errors

Property Description

Holds all serialized errors thrown from the map(mapContext) function. May also hold the SSS_APP_SERVER_RESTART error code, which is recorded in the event of an application server restart.

Type

iterator

Since

2015.2

Members

Member

Type

Required/Optional

Description

iterator().each(parameters)

function

required

Executes one time for each error.

parameters

Member

Type

Required/Optional

Description

iteratorFunction(key, error, executionNo)

See also functionParameters.

function

required

Provides logic to be executed during each iteration.

functionParameters

Parameter

Type

Required/Optional

Description

key

string

optional

Represents a key that was passed to the map stage for processing.

error

string

optional

The error thrown during processing of the corresponding key.

executionNo

number

optional

Indicates whether the error occurred during the first, second, third, or fourth attempt to process the key.

Syntax

The following snippets show three ways you could use this iterator.

This code is not a functional example. For a complete script example, see Map/Reduce Script Samples.

          // Add additional code
...
// Create a log entry showing each full serialized error
summary.mapSummary.errors.iterator().each(
    function (key, error, executionNo) {
        log.error({
            title: 'Map error for key: ' + key + ", execution no.  ' + executionNo,
            details: error
        });
        return true;
    }
);

// Log only the name and description of each error thrown
summary.mapSummary.errors.iterator().each(
    function (key, error, executionNo) {
        var errorObject = JSON.parse(error);
        log.error({
               title:  Map error for key: ' + key + ", execution no. ' + executionNo,
            details: errorObject.name + ': ' + errorObject.message
        });
        return true;
    }
);

// Calculate and log the total number of errors encountered during the map stage
var errorCount = 0;
summary.mapSummary.errors.iterator().each(
    function() {
        errorCount++;
        return true;
    }
);

log.audit({
    title: Map stage errors', 
    details: 'Total number of errors: ' + errorCount 
});
...
// Add additional code 

        

Related Topics

General Notices