Skip to content
Snippets Groups Projects
Commit 54688447 authored by Valentin Rigal's avatar Valentin Rigal
Browse files

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

parent 66fa30c6
No related branches found
No related tags found
No related merge requests found
......@@ -149,11 +149,8 @@ class ElementsWorker(
self.update_activity(element.id, ActivityState.Processed)
except Exception as e:
failed += 1
element_id = (
element.id
if isinstance(element, (Element, CachedElement))
else item
)
# Handle the case where we failed retrieving the element
element_id = element.id if element else item
if isinstance(e, ErrorResponse):
message = f"An API error occurred while processing element {element_id}: {e.title} - {e.content}"
......@@ -164,7 +161,8 @@ class ElementsWorker(
message,
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)
# 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