diff --git a/press/agent.py b/press/agent.py index 3e37165c80..d5a62a475c 100644 --- a/press/agent.py +++ b/press/agent.py @@ -797,8 +797,8 @@ def request(self, method, path, data=None, files=None, agent_job=None, raises=Tr doc=agent_job, ) except Exception as exc: - self.handle_exception(agent_job, exc) self.log_request_failure(exc) + self.handle_exception(agent_job, exc) log_error( title="Agent Request Exception", method=method, @@ -853,7 +853,7 @@ def should_skip_requests(self): def handle_request_failure(self, agent_job, result: "Response"): if not agent_job: - return + raise reason = None with suppress(TypeError, ValueError): @@ -871,7 +871,7 @@ def handle_exception(self, agent_job, exception): def log_failure_reason(self, agent_job=None, message=None): if not agent_job: - return + raise agent_job.traceback = message agent_job.output = message