Skip to content

Commit 6f39f8b

Browse files
cailmdaleyclaude
andcommitted
fix: raise constructed exceptions that were silently discarded
Several guard clauses constructed an exception object but never raised it, so the error path fell through instead of failing loud. For the PSFEx interpolation runner (#785) this meant a typo'd MODE skipped all branches, returned (None, None), and let the pipeline record success with no interpolated PSF catalogue. Add the missing `raise` at every site found by grepping src for constructed-but-unraised exceptions: - modules/psfex_interp_runner.py invalid MODE (#785) - modules/mccd_interp_runner.py invalid MODE (x2: VALIDATION + else) - modules/mask_package/mask.py invalid mask type - pipeline/file_handler.py non-str match pattern - pipeline/file_io.py non-ndarray col_data Closes #785 Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 47bbce5 commit 6f39f8b

5 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/shapepipe/modules/mask_package/mask.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,7 @@ def _exec_WW(self, types="HALO"):
10701070
self._WW_stdout, self._WW_stderr = execute(cmd)
10711071

10721072
else:
1073-
ValueError("Types must be in ['HALO','SPIKE','ALL']")
1073+
raise ValueError("Types must be in ['HALO','SPIKE','ALL']")
10741074

10751075
if (self._WW_stderr != "") or (self._rm_reg_stderr != ""):
10761076
self._err = True

src/shapepipe/modules/mccd_interp_runner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ def mccd_interp_runner(
114114
inst.process_me(psf_model_dir, psf_model_pattern, f_wcs_path)
115115

116116
elif mode == "VALIDATION":
117-
ValueError(
117+
raise ValueError(
118118
"MODE has to be in MULTI-EPOCH or CLASSIC. For validation"
119119
+ " use MCCD validation runner."
120120
)
121121

122122
else:
123-
ValueError("MODE has to be in : [CLASSIC, MULTI-EPOCH]")
123+
raise ValueError("MODE has to be in : [CLASSIC, MULTI-EPOCH]")
124124

125125
# No return objects
126126
return None, None

src/shapepipe/modules/psfex_interp_runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def psfex_interp_runner(
150150

151151
else:
152152
# Raise error for invalid run mode
153-
ValueError("MODE has to be in : [CLASSIC, MULTI-EPOCH, VALIDATION]")
153+
raise ValueError("MODE has to be in : [CLASSIC, MULTI-EPOCH, VALIDATION]")
154154

155155
# No return objects
156156
return None, None

src/shapepipe/pipeline/file_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ def _generate_re_pattern(match_pattern):
792792
793793
"""
794794
if not isinstance(match_pattern, str):
795-
TypeError("Match pattern must be a string.")
795+
raise TypeError("Match pattern must be a string.")
796796

797797
chars = [char for char in match_pattern if not char.isalnum()]
798798
split_pattern = "|".join(chars).replace(".", r"\.")

src/shapepipe/pipeline/file_io.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,7 @@ def add_col(
13891389
)
13901390

13911391
if type(col_data) != np.ndarray:
1392-
TypeError("col_data must be a numpy.ndarray")
1392+
raise TypeError("col_data must be a numpy.ndarray")
13931393

13941394
if hdu_no is None:
13951395
hdu_no = self.hdu_no

0 commit comments

Comments
 (0)