Skip to content

process.reject

Use this function in the data method of a process to exit execution. The message will be recorded and displayed in the process log upon process completion.

js
process.reject(group, message)
process.reject(message)

Parameters

  • group (string): An optional name for the group to which the message belongs. This can be used to categorize logs when the process completes. If not provided, the message will be logged without grouping. (optional)
  • message (string): The message to be logged when the process completes.

Examples

js
function data(record) {
    // This function is called once for each line of data on the second cycle
    // Use this to build dimensions and push data into cubes

    if(record.name == "Demo") {
        process.reject("Error", "Rejecting record with name 'Demo'.");
    }

    // Continue rest of data function
}

In this example, when process.reject() is called, the process exits the data method. Upon process completion, the message is logged under the group "Error".

The log output at the end of the process aggregates and displays each message with a counter indicating how many times each event occurred. For instance, if three records were rejected due to their name being 'Demo':

plaintext
Rejection Log:
Group: Error
Rejecting record with name 'Demo'. [3]