Skip to content

Commit e07deb7

Browse files
committed
wado-rs now re-codes OSError to DICOMTrolleyError. Extends docstrings Fixes #58
1 parent c0605be commit e07deb7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

dicomtrolley/wado_rs.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def datasets(self, objects: Sequence[DICOMDownloadable]):
120120
)
121121

122122
def download_iterator(self, downloadable: DICOMDownloadable):
123-
"""Perform a wado RS request and iterate over the returned datasets
123+
"""Perform a wado RS request and iterate over the returned datasets.
124124
125125
Returns
126126
-------
@@ -147,7 +147,7 @@ def parse(self, response) -> Iterator[Dataset]:
147147
Raises
148148
------
149149
DICOMTrolleyError
150-
If response is not as expected or if parsing fails
150+
If response is not as expected or if parsing fails.
151151
152152
Returns
153153
-------
@@ -172,6 +172,10 @@ def parse(self, response) -> Iterator[Dataset]:
172172
f" Response content (first 300 elements) was"
173173
f" {str(response.content[:300])}"
174174
) from e
175+
except OSError as e: # pydicom might validly raise this on bad DICOM
176+
raise DICOMTrolleyError(
177+
"Error parsing response as DICOM"
178+
) from e
175179

176180
@staticmethod
177181
def check_for_response_errors(response):

0 commit comments

Comments
 (0)