ErrorTracker
Index
Constructors
constructor
Parameters
options: Partial<ErrorTrackerOptions> = {}
Returns ErrorTracker
Properties
result
total
Methods
add
Parameters
error: ErrnoException
Returns void
getMostPopularErrors
Parameters
count: number
Returns [number, string[]][]
getUniqueErrorCount
Returns number
reset
Returns void
This class tracks errors and computes a summary of information like:
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 asRecord<string, unknown>
. The most deep object has acount
property, which is a number.It's possible to get the total amount of errors via the
tracker.total
property.