diff --git a/tests/test_query.py b/tests/test_query.py index b0bdaec..d215b95 100644 --- a/tests/test_query.py +++ b/tests/test_query.py @@ -206,7 +206,7 @@ def test_query_job(dicom_server, tempdir, rq_connection,fs): try: example_dcm = next(k for k in Path(tempdir).rglob("*.dcm")) except StopIteration: - assert False, f"No DICOM file found in {tempdir}" + raise Exception(f"No DICOM file found in {tempdir}") assert pydicom.dcmread(example_dcm).AccessionNumber == MOCK_ACCESSIONS[0] def tree(path, prefix='', level=0) -> None: diff --git a/webinterface/dashboards/query/jobs.py b/webinterface/dashboards/query/jobs.py index d6b6697..4cbf716 100644 --- a/webinterface/dashboards/query/jobs.py +++ b/webinterface/dashboards/query/jobs.py @@ -123,7 +123,10 @@ def execute(self, *, accessions: List[str], node: Union[DicomTarget, DicomWebTar self._job.meta['failed_reason'] = str(e) self._job.save_meta() # type: ignore if self.parent and (job_parent := Job.fetch(self.parent)): - job_parent.meta['failed_reason'] = e.args[0] + if e.args: + job_parent.meta['failed_reason'] = f"{str(e)} ({str(e.args[0])})" + else: + job_parent.meta['failed_reason'] = str(e) job_parent.save_meta() # type: ignore Queue(job_parent.origin)._enqueue_job(job_parent,at_front=True) raise