diff options
| author | horus | 2018-02-19 22:54:08 +0100 |
|---|---|---|
| committer | horus | 2018-02-19 22:54:08 +0100 |
| commit | ee92a7e43df5a7272842b1434d20713dcfd06387 (patch) | |
| tree | 8f48d2017031f0572aec0a2b32a48bcac0fa778d /crawler | |
| parent | 13b1e31cb91f5af98951f4353d49429f356d7f12 (diff) | |
| download | alkobote-ee92a7e43df5a7272842b1434d20713dcfd06387.tar.gz | |
Less Fatal(), more Warn(). (crawler)
Diffstat (limited to 'crawler')
| -rw-r--r-- | crawler/sanitize.go | 3 | ||||
| -rw-r--r-- | crawler/shop_whic.go | 3 | ||||
| -rw-r--r-- | crawler/utility.go | 6 |
3 files changed, 8 insertions, 4 deletions
diff --git a/crawler/sanitize.go b/crawler/sanitize.go index 346100a..27921d5 100644 --- a/crawler/sanitize.go +++ b/crawler/sanitize.go @@ -242,7 +242,8 @@ func get_age_from_name(name string) int { age, err := strconv.Atoi(age_noisy) if err != nil { - Fatal(err, "get_age_from_name: String to int (atoi) failed") + Warn(err, "get_age_from_name: String to int (atoi) failed") + return 0 } return age } diff --git a/crawler/shop_whic.go b/crawler/shop_whic.go index a199b2c..af86bdc 100644 --- a/crawler/shop_whic.go +++ b/crawler/shop_whic.go @@ -74,7 +74,8 @@ func (app *App) ScrapeWhic(shop Shop) []Angebot { if err != nil { W.error_msg = err.Error() W.error_ctx = img_link_noisy - FatalOffer(W, "Whic: Parsing document in Goquery failed") + WarnOffer(W, "Whic: Parsing document in Goquery failed") + return } W.Image_url, _ = doc.Find("img").Attr("src") diff --git a/crawler/utility.go b/crawler/utility.go index a90de91..5fa78c4 100644 --- a/crawler/utility.go +++ b/crawler/utility.go @@ -146,7 +146,8 @@ func get_volume(e *colly.HTMLElement) (float32, string) { volume, err := extract_volume(volume_noisy) if err != nil { - Fatal(err, "Get Volume: Extract Volume failed: "+volume_noisy) + Warn(err, "Get Volume: Extract Volume failed: "+volume_noisy) + return 0, err.Error() + " // volume_noisy: " + volume_noisy } return volume, "" @@ -166,7 +167,8 @@ func get_abv(e *colly.HTMLElement) (float32, string) { abv, err := extract_abv(abv_noisy) if err != nil { - Fatal(err, "Get ABV: Extract ABV failed: "+abv_noisy) + Warn(err, "Get ABV: Extract ABV failed: "+abv_noisy) + return 0, err.Error() + " // abv_noisy: " + abv_noisy } return abv, "" |
