Throw on invalid data
This commit is contained in:
parent
a9d49c41ee
commit
8d2fd71f61
|
@ -41,6 +41,10 @@ async function getVideos (host: string, start: number): Promise<IndexableVideo[]
|
||||||
json: true
|
json: true
|
||||||
}, REQUESTS.MAX_RETRIES, REQUESTS.WAIT)
|
}, REQUESTS.MAX_RETRIES, REQUESTS.WAIT)
|
||||||
|
|
||||||
|
if (!res.body || !Array.isArray(res.body.data)) {
|
||||||
|
throw new Error('Invalid video data from ' + url)
|
||||||
|
}
|
||||||
|
|
||||||
return res.body.data.map(v => prepareVideoForDB(v, host))
|
return res.body.data.map(v => prepareVideoForDB(v, host))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue