Skip to content

fix: raise constructed-but-discarded exceptions (Closes #785)#789

Open
cailmdaley wants to merge 1 commit into
developfrom
fix-785-psfex-mode-raise
Open

fix: raise constructed-but-discarded exceptions (Closes #785)#789
cailmdaley wants to merge 1 commit into
developfrom
fix-785-psfex-mode-raise

Conversation

@cailmdaley

Copy link
Copy Markdown
Contributor

Summary

Fixes #785: in psfex_interp_runner.py, the guard for an unrecognized MODE constructed a ValueError but never raised it. A typo'd MODE skipped all branches, the runner returned (None, None), and the pipeline recorded success while producing no interpolated PSF catalogue — failing only downstream, or not at all.

Adds the missing raise, then extends the fix to every other constructed-but-unraised exception found by grepping src/:

File Guard
modules/psfex_interp_runner.py invalid MODE (#785)
modules/mccd_interp_runner.py invalid MODE — two sites (VALIDATION branch + final else)
modules/mask_package/mask.py invalid mask type
pipeline/file_handler.py non-str match pattern (docstring already advertises TypeError)
pipeline/file_io.py non-ndarray col_data

All five were the same latent bug: an error path that constructs an exception, discards it, and falls through.

On Martin's question — is VALIDATION ever used?

Yes. psfex_interp VALIDATION is a live mode: active example configs set MODE = VALIDATION (config_exp_psfex.ini, config_exp_Pi.ini) and it dispatches to the real PSFExInterpolator.process_validation. It is not a dead branch, so it stays in the error message. (Note the mccd_interp_runner VALIDATION branch is different — it exists only to redirect users to the dedicated MCCD validation runner, and now raises as intended.)

Provenance

Pre-existing on develop (predates #741); surfaced by the final integrated review of the ngmix v2.0 diff.

🤖 Generated with Claude Code

— Claude (Opus) on behalf of Cail

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

psfex_interp_runner: invalid MODE constructs a ValueError but never raises it

1 participant