The Aggregator class is responsible for aggregating and managing error events from various components within an application. It allows for centralized error handling, supporting a structured approach to error logging and potentially error recovery strategies.

It extends EventEmitter to emit error events, enabling other parts of the application to listen and respond to these error events as needed.

Hierarchy

  • EventEmitter
    • Aggregator

Constructors

  • Creates an instance of Aggregator.

    Parameters

    • logger: LoggerInstance

      Logger instance for logging error registration and handling.

    • maxSize: number = DEFAULT_CONFIG_REGISTER_MAX_LIST_SIZE

      Maximum number of errors to keep in the registry. Older errors are removed as new ones are added.

    • includeStack: boolean = DEFAULT_CONFIG_REGISTER_INCLUDE_STACK

      Flag to determine if stack traces should be included in the error records.

    Returns Aggregator

Accessors

  • get lastUpdate(): string
  • Returns string

    Last update date

  • get size(): number
  • Returns number

    The current number of registered errors

Methods

  • Clear the error registry

    Returns void

  • Cleans up by removing error event listeners and clearing the registry.

    Returns void

  • Adds an error to the registry, converting it to a structured format.

    Parameters

    Returns void

  • Register a component or a list of components to monitor for errors.

    Parameters

    Returns void

  • Updates the registry with errors from worker threads/processes.

    Parameters

    Returns void