taxref: catch errors on JSON decoding
This commit is contained in:
parent
65f9e8494a
commit
92f0ab3fef
|
@ -73,7 +73,12 @@ class TaxrefPlugin(Plugin):
|
||||||
if response.status_code != 200:
|
if response.status_code != 200:
|
||||||
self.signal_failure(target)
|
self.signal_failure(target)
|
||||||
return
|
return
|
||||||
data = response.json()
|
try:
|
||||||
|
data = response.json()
|
||||||
|
except ValueError:
|
||||||
|
self.signal_failure(target)
|
||||||
|
return
|
||||||
|
|
||||||
items = data.get("_embedded", {}).get("taxa", [])
|
items = data.get("_embedded", {}).get("taxa", [])
|
||||||
|
|
||||||
if not items:
|
if not items:
|
||||||
|
@ -195,7 +200,11 @@ class TaxrefPlugin(Plugin):
|
||||||
if response.status_code != 200:
|
if response.status_code != 200:
|
||||||
self.signal_failure(target)
|
self.signal_failure(target)
|
||||||
return
|
return
|
||||||
data = response.json()
|
try:
|
||||||
|
data = response.json()
|
||||||
|
except ValueError:
|
||||||
|
self.signal_failure(target)
|
||||||
|
return
|
||||||
items = data.get("_embedded", {}).get("taxa", [])
|
items = data.get("_embedded", {}).get("taxa", [])
|
||||||
|
|
||||||
if not items:
|
if not items:
|
||||||
|
|
Loading…
Reference in a new issue