ErrorSnapshotter
Index
Constructors
constructor
Returns ErrorSnapshotter
Properties
staticreadonlyBASE_MESSAGE
staticreadonlyMAX_ERROR_CHARACTERS
staticreadonlyMAX_FILENAME_LENGTH
staticreadonlyMAX_HASH_LENGTH
staticreadonlySNAPSHOT_PREFIX
Methods
captureSnapshot
Capture a snapshot of the error context.
Parameters
error: ErrnoException
context: CrawlingContext<unknown, Dictionary>
Returns Promise<{ htmlFileName?: string; screenshotFileName?: string }>
contextCaptureSnapshot
Captures a snapshot of the current page using the context.saveSnapshot function. This function is applicable for browser contexts only. Returns an object containing the filenames of the screenshot and HTML file.
Parameters
context: BrowserCrawlingContext
fileName: string
Returns Promise<undefined | SnapshotResult>
generateFilename
Generate a unique fileName for each error snapshot.
Parameters
error: ErrnoException
Returns string
saveHTMLSnapshot
Save the HTML snapshot of the page, and return the fileName with the extension.
Parameters
html: string
keyValueStore: KeyValueStore
fileName: string
Returns Promise<undefined | string>
ErrorSnapshotter class is used to capture a screenshot of the page and a snapshot of the HTML when an error occurs during web crawling.
This functionality is opt-in, and can be enabled via the crawler options: