Merge pull request #457 from trustar/main

added more explicit error messages for indicators that return no enri…
pull/466/head
Alexandre Dulaunoy 2020-12-04 21:37:47 +01:00 committed by GitHub
commit ff9ac60bbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -195,12 +195,16 @@ def handler(q=False):
try:
metadata = trustar_parser.ts_client.get_indicators_metadata([Indicator(value=attribute['value'])])[0]
except IndexError:
misperrors['error'] += f" -- No metadata found for indicator {attribute['value']}"
except Exception as e:
misperrors['error'] += f" -- Could not retrieve indicator metadata from TruSTAR {e}"
try:
summary = list(
trustar_parser.ts_client.get_indicator_summaries([attribute['value']], page_size=MAX_PAGE_SIZE))[0]
except IndexError:
misperrors['error'] += f" -- No summary data found for indicator {attribute['value']}"
except Exception as e:
misperrors['error'] += f" -- Unable to retrieve TruSTAR summary data: {e}"