mirror of https://github.com/CIRCL/lookyloo
fix: Catch exception when getting redirects on broken capture
parent
ecf58b512d
commit
63ba82dd0e
|
@ -127,7 +127,9 @@ class CaptureRedirects(Resource):
|
|||
if not cache:
|
||||
return {'error': 'UUID missing in cache, try again later and check the status first.'}, 400
|
||||
|
||||
to_return: Dict[str, Any] = {'response': {'url': cache.url, 'redirects': []}}
|
||||
to_return: Dict[str, Any] = {}
|
||||
try:
|
||||
to_return = {'response': {'url': cache.url, 'redirects': []}}
|
||||
if not cache.redirects:
|
||||
to_return['response']['info'] = 'No redirects'
|
||||
return to_return
|
||||
|
@ -139,7 +141,11 @@ class CaptureRedirects(Resource):
|
|||
to_return['response']['redirects'] = cache.redirects
|
||||
else:
|
||||
to_return['response']['redirects'] = cache.redirects
|
||||
|
||||
except Exception as e:
|
||||
if cache and hasattr(cache, 'error'):
|
||||
to_return['error'] = cache.error
|
||||
else:
|
||||
to_return['error'] = str(e)
|
||||
return to_return
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue