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:
|
||||
self.signal_failure(target)
|
||||
return
|
||||
try:
|
||||
data = response.json()
|
||||
except ValueError:
|
||||
self.signal_failure(target)
|
||||
return
|
||||
|
||||
items = data.get("_embedded", {}).get("taxa", [])
|
||||
|
||||
if not items:
|
||||
|
@ -195,7 +200,11 @@ class TaxrefPlugin(Plugin):
|
|||
if response.status_code != 200:
|
||||
self.signal_failure(target)
|
||||
return
|
||||
try:
|
||||
data = response.json()
|
||||
except ValueError:
|
||||
self.signal_failure(target)
|
||||
return
|
||||
items = data.get("_embedded", {}).get("taxa", [])
|
||||
|
||||
if not items:
|
||||
|
|
Loading…
Reference in a new issue