Skip to content

Commit

Permalink
fix(crawler): make "fl" crawler throw when trying to parse unexpected…
Browse files Browse the repository at this point in the history
… content
  • Loading branch information
kkkrist committed Oct 29, 2020
1 parent 8acd1ec commit be00903
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions packages/crawler/lib/fl.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,24 @@ module.exports = () =>

const timeMatch = content.match(/Stand ([0-9]+)\.([0-9]+) Uhr/)

if (
!infectedMatch ||
!recoveredMatch ||
!quarantinedMatch ||
!deathsMatch ||
!dateMatch
) {
return data
if (!infectedMatch) {
throw new Error(`Couldn't parse infected of ${date.textContent}`)
}

if (!recoveredMatch) {
throw new Error(`Couldn't parse recovered of ${date.textContent}`)
}

if (!quarantinedMatch) {
throw new Error(`Couldn't parse quarantined of ${date.textContent}`)
}

if (!deathsMatch) {
throw new Error(`Couldn't parse deaths of ${date.textContent}`)
}

if (!dateMatch) {
throw new Error(`Couldn't parse date of ${date.textContent}`)
}

const entry = {
Expand Down

0 comments on commit be00903

Please sign in to comment.