mirror of
https://framagit.org/framasoft/peertube/search-index/
synced 2024-12-24 00:21:05 +01:00
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
|
||||
}, 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))
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user