new BatchError()

This type represents all errors rejected by method batch, except for TypeError when the method receives invalid input parameters.

Name Type Description
name string

Standard Error property - error type name = BatchError.

message string

Standard Error property - the error message.

It represents the message of the first error encountered in the batch, and is a safe version of using first.message.

stack string

Standard Error property - the stack trace.

data array

Array of objects {success, result, [origin]}:

  • success = true/false, indicates whether the corresponding value in the input array was resolved.
  • result = resolved data, if success=true, or else the rejection reason.
  • origin - set only when failed as a result of an unsuccessful call into the notification callback (parameter cb of method batch)

The array has the same size as the input one that was passed into method batch, providing direct mapping.


Resolution Statistics.

Name Type Description
total number

Total number of elements in the batch.

succeeded number

Number of resolved values in the batch.

failed number

Number of rejected values in the batch.

duration number

Time in milliseconds it took to settle all values.


The very first error within the batch, with support for nested batch results, it is also the same error as promise.all would provide.




(static) toString(levelopt) → {string}

Creates a well-formatted multi-line string that represents the error.

It is called automatically when writing the object into the console.

The output is an abbreviated version of the error, because the complete error is often too much for displaying or even logging, as a batch can be of any size. Therefore, only errors are rendered from the data property, alongside their indexes, and only up to the first 5, to avoid polluting the screen or the log file.

Name Type Attributes Default Description
level number <optional>

Nested output level, to provide visual offset.