Skip to content
This repository was archived by the owner on Dec 8, 2023. It is now read-only.

Commit d721c88

Browse files
authored
Update alma/endpoints/exports.py
1 parent 7d0e0ff commit d721c88

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

alma/endpoints/exports.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ def create(
3535
if custom_fields:
3636
if isinstance(custom_fields, str):
3737
data["custom_fields"] = custom_fields
38-
elif type(custom_fields) in (list, tuple, set):
39-
data["custom_fields"] = ",".join(custom_fields)
4038
else:
41-
raise TypeError(f"Expected comma-separated string or a list/tuple/set of strings for custom_fields, got {type(custom_fields)}")
39+
try:
40+
data["custom_fields"] = ",".join(custom_fields)
41+
except TypeError as e:
42+
raise TypeError(f"Expected comma-separated string or an iterable yielding strings for custom_fields, got {type(custom_fields)}") from e
4243

4344
return self.request(self.EXPORTS_PATH).set_body(data).post().expectJson(Export)
4445

0 commit comments

Comments
 (0)