fix: [farsight_passivedns] Handling exceptions raised from a query error

- This can happen with for instance a wrong server URL
pull/499/head
chrisr3d 2021-05-04 18:36:56 +02:00
parent 8e55101dc8
commit 780590cee3
No known key found for this signature in database
GPG Key ID: 6BBED1B63A6D639F
1 changed files with 2 additions and 0 deletions

View File

@ -148,6 +148,8 @@ def handler(q=False):
response = to_query(client, *args)
except dnsdb2.DnsdbException as e:
return {'error': e.__str__()}
except dnsdb2.exceptions.QueryError:
return {'error': 'Communication error occurs while executing a query, or the server reports an error due to invalid arguments.'}
if not response:
return {'error': f"Empty results on Farsight DNSDB for the {TYPE_TO_FEATURE[attribute['type']]}: {attribute['value']}."}
parser = FarsightDnsdbParser(attribute)