ValidationError
Error instance with additional Object property errorObjects which content all the error information, see ajv error.
ListValidationError
Error instance with additional Array property validationError of ValidationError instance.
options.paramsSchema
The JSON schema that defines the shape of the accepted arguments passed to options.request. When invalid, an Error will be thrown.
Optional
options.validateList
Use this option to validate each item of the data extracted individually. When true, the data extracted is required to be an Array, otherwise an Error is returned in callback.
Optional, default: false
scraper function callback(error, data)
- When a network request error occurred, the callback
errorargument will be an Error and thedatawill be null. - When
options.validateList = falseand a validation error occurred,errorwill be a ValidationError and thedatawill be null. Otherwise, theerrorwill be null anddatawill be the returned value ofoptions.extract. - When
options.validateList = trueand a validation errors occurred,errorwill be a ListValidationError, otherwise it will be null. If the value returned byoptions.extractis not an Array,errorwill be an instance of Error. Thedataalways be an Array that only contains the valid item returned byoptions.extract. It's not becauseerroris a ListValidationError that there will be nodata!