The RegisterFacade class provides a centralized solution for error monitoring across all components of an application. It acts as a facade over various underlying mechanisms to facilitate error aggregation, error information exposure through REST APIs, and error registry management.

It integrates with:

  • Port: To handle inter-process communication for error information in clustered environments, distinguishing between master and worker processes.
  • Aggregator: To aggregate error information from different components of the application.

This class also provides a REST API endpoint for accessing collected error information and supports operations for registering errors and clearing the error registry.

Hierarchy

  • EventEmitter
    • RegisterFacade

Implements

Constructors

Accessors

  • get componentId(): string
  • Returns string

    The application identifier

  • get lastUpdate(): string
  • Returns string

    Last update date

  • Returns { [link: string]: string }

    Links offered by this service

  • get name(): string
  • Returns string

    The application name

  • get router(): Router
  • Returns Router

    An Express router with access to registered errors

  • get size(): number
  • Returns number

    The current number of registered errors

  • get status(): "pass" | "fail" | "warn"
  • Returns "pass" | "fail" | "warn"

    The health status of the component

Methods

  • Clear the error registry

    Returns void

  • Closes the error registry service, performing cleanup actions as necessary.

    Returns Promise<void>

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

    Parameters

    Returns void

  • Registers one or multiple components to be monitored.

    Parameters

    Returns void

  • Starts the error registry service, including the communication port and error event listeners.

    Returns Promise<void>

  • Stops the error registry service, including halting communication and removing event listeners.

    Returns Promise<void>