fix: raise constructed-but-discarded exceptions (Closes #785)#789
Open
cailmdaley wants to merge 1 commit into
Open
fix: raise constructed-but-discarded exceptions (Closes #785)#789cailmdaley wants to merge 1 commit into
cailmdaley wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #785: in
psfex_interp_runner.py, the guard for an unrecognizedMODEconstructed aValueErrorbut neverraised it. A typo'dMODEskipped 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 greppingsrc/:modules/psfex_interp_runner.pyMODE(#785)modules/mccd_interp_runner.pyMODE— two sites (VALIDATIONbranch + finalelse)modules/mask_package/mask.pypipeline/file_handler.pystrmatch pattern (docstring already advertisesTypeError)pipeline/file_io.pyndarraycol_dataAll five were the same latent bug: an error path that constructs an exception, discards it, and falls through.
On Martin's question — is
VALIDATIONever used?Yes.
psfex_interpVALIDATIONis a live mode: active example configs setMODE = VALIDATION(config_exp_psfex.ini,config_exp_Pi.ini) and it dispatches to the realPSFExInterpolator.process_validation. It is not a dead branch, so it stays in the error message. (Note themccd_interp_runnerVALIDATIONbranch 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