Skip to content

Commit abf54c1

Browse files
Copilotnolan1999
andcommitted
Address PR feedback: improve exception handling and error messages
Co-authored-by: nolan1999 <54246789+nolan1999@users.noreply.github.com>
1 parent b82628a commit abf54c1

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

tests/unit/crud/test_job_tracking.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ def test_update_job_raises_job_deleted_exception(mock_put):
2121
with pytest.raises(JobDeletedException) as exc_info:
2222
update_job(job_id, JobStates.running)
2323

24-
assert "it was probably deleted by the user" in str(exc_info.value)
24+
assert f"Job {job_id} not found; it was probably deleted by the user." in str(exc_info.value)

workerfacing_api/core/queue.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ def _update_job_status(
510510
# job probably deleted by user
511511
session.delete(job)
512512
session.commit()
513-
raise JobDeletedException(f"Could not update job, probably deleted by user: {e}")
513+
raise e from e
514514

515515
def update_job_status(
516516
self,

workerfacing_api/crud/job_tracking.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ def update_job(
2020
headers={"x-api-key": settings.internal_api_key_secret},
2121
)
2222
if resp.status_code == 404:
23-
raise JobDeletedException("it was probably deleted by the user")
23+
raise JobDeletedException(f"Job {job_id} not found; it was probably deleted by the user.")
2424
resp.raise_for_status()

0 commit comments

Comments
 (0)