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

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

parent 74e2c4c4
No related branches found
No related tags found
1 merge request!109Handle concurrency while initializing activity
......@@ -151,11 +151,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}"
......@@ -166,7 +163,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