ErrorTracker
Index
Constructors
Properties
Methods
Constructors
constructor
Parameters
options: Partial<ErrorTrackerOptions> = {}
Returns ErrorTracker
Properties
optionalerrorSnapshotter
result
total
Methods
add
Parameters
error: ErrnoException
Returns void
addAsync
This method is async, because it captures a snapshot of the error context. We added this new method to avoid breaking changes.
Parameters
error: ErrnoException
optionalcontext: CrawlingContext<unknown, Dictionary>
Returns Promise<void>
captureSnapshot
Parameters
storage: Record<string, unknown>
error: ErrnoException
context: CrawlingContext<unknown, Dictionary>
Returns Promise<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.