-
Notifications
You must be signed in to change notification settings - Fork 57
Description
Description
ParDict.load_param_file_into_dict() and ParDict.__process_parameter_line() raise SystemExit on any malformed parameter file (invalid name, duplicate parameter, non-finite value, encoding error, etc.).
SystemExit bypasses except Exception handlers, which means any caller wrapping the load in a try/except will still see their GUI application terminated immediately. Users lose unsaved work with no opportunity to fix the file or skip the bad parameter.
Affected Code
data_model_par_dict.py — 7 separate raise SystemExit(msg) calls:
- Line 162: Missing parameter-value separator
- Line 171: Non-UTF-8 encoding
- Line 188: Parameter name too long
- Line 193: Invalid parameter name characters
- Line 198: Duplicated parameter
- Line 205: Non-finite value (inf, nan)
- Line 211: Invalid parameter value (not a number)
- Line 276: Unsupported file format
Impact
Combined with non-atomic file writes (direct write to target file, no temp+rename), a power loss during a parameter write can corrupt the file. On next startup, the corrupted file triggers SystemExit, preventing the app from ever opening again (crash loop).
Proposed Fix
Replace SystemExit with a custom exception (e.g., ParamFileError(ValueError)) that callers can catch with standard except Exception or except ValueError. This allows the GUI to show an error dialog and let the user fix or skip the problematic file.