Skip to main content
Version: 3.8

ErrorTracker

This class tracks errors and computes a summary of information like:

  • where the errors happened
  • what the error names are
  • what the error codes are
  • what is the general error message

This is extremely useful when there are dynamic error messages, such as argument validation.

Since the structure of the tracker.result object differs when using different options, it's typed as Record<string, unknown>. The most deep object has a count property, which is a number.

It's possible to get the total amount of errors via the tracker.total property.

Index

Constructors

constructor

Properties

result

result: Record<string, unknown>

total

total: number

Methods

add

  • add(error: ErrnoException): void
  • Parameters

    • error: ErrnoException

    Returns void

getMostPopularErrors

  • getMostPopularErrors(count: number): [number, string[]][]
  • Parameters

    • count: number

    Returns [number, string[]][]

getUniqueErrorCount

  • getUniqueErrorCount(): number
  • Returns number

reset

  • reset(): void
  • Returns void