Skip to content
Snippets Groups Projects
Commit 9b2c2752 authored by Valentin Rigal's avatar Valentin Rigal Committed by Bastien Abadie
Browse files

Avoid updating activity to error when we could not fetch the element

parent ef3a9565
No related branches found
No related tags found
No related merge requests found
...@@ -151,11 +151,8 @@ class ElementsWorker( ...@@ -151,11 +151,8 @@ class ElementsWorker(
self.update_activity(element.id, ActivityState.Processed) self.update_activity(element.id, ActivityState.Processed)
except Exception as e: except Exception as e:
failed += 1 failed += 1
element_id = ( # Handle the case where we failed retrieving the element
element.id element_id = element.id if element else item
if isinstance(element, (Element, CachedElement))
else item
)
if isinstance(e, ErrorResponse): if isinstance(e, ErrorResponse):
message = f"An API error occurred while processing element {element_id}: {e.title} - {e.content}" message = f"An API error occurred while processing element {element_id}: {e.title} - {e.content}"
...@@ -166,7 +163,8 @@ class ElementsWorker( ...@@ -166,7 +163,8 @@ class ElementsWorker(
message, message,
exc_info=e if self.args.verbose else None, exc_info=e if self.args.verbose else None,
) )
self.update_activity(element_id, ActivityState.Error) if element:
self.update_activity(element.id, ActivityState.Error)
self.report.error(element_id, e) self.report.error(element_id, e)
# Save report as local artifact # Save report as local artifact
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment