Skip to content

Commit 9e863df

Browse files
committed
Raise when get_map gets a invalid space argument
1 parent d35e49b commit 9e863df

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

siibra/core/parcellation.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -177,15 +177,14 @@ def get_map(self, space=None, maptype: Union[str, MapType] = MapType.LABELLED, s
177177
and m.parcellation.matches(self)
178178
]
179179
if len(candidates) == 0:
180-
logger.error(f"No {maptype} map in {space} available for {str(self)}")
181-
return None
180+
raise ValueError(f"No {maptype} map with space specification '{space}' available for {str(self)}")
182181
if len(candidates) > 1:
183182
spec_candidates = [
184-
c for c in candidates if all(w.lower() in c.name.lower() for w in spec.split())
183+
c for c in candidates
184+
if all(w.lower() in c.name.lower() for w in spec.split())
185185
]
186186
if len(spec_candidates) == 0:
187-
logger.warning(f"'{spec}' does not match any options from {[c.name for c in candidates]}.")
188-
return None
187+
raise ValueError(f"'{spec}' does not match any options from {[c.name for c in candidates]}.")
189188
if len(spec_candidates) > 1:
190189
logger.warning(
191190
f"Multiple maps are available in this specification of space, parcellation, and map type.\n"

0 commit comments

Comments
 (0)