Repository navigation
Hardening 2/4: every error code explained; clear messages for unusable formulas - #119
Merged
Merged
Conversation
…be used (hardening 2/4)
rafatahmed
added a commit
that referenced
this pull request
Nov 7, 2026
Hardening 2/4: every error code explained; clear messages for unusable formulas
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.
Second of four hardening PRs (entry points, errors, PEP 8 and file headers, docstrings).
Error code reference
The shipped user guide (USER_GUIDE.md, section 8) now explains all 91
DeliveryErrorcodes: 68 were undocumented. Grouped by what you were doing (input values and files; water analysis; products and materials; recipe, limits and pH; chemistry model; stocks, tanks and injection; delivery plans, EC and reference data), each with its meaning and what to do, written from the messages the code actually raises.tests/test_error_catalogue.pyfails if any raised code is missing (it found one the manual sweep missed,invalid_ions).Formula messages
A material with an unusable formula said 'give its formula, its ions, or its analysis' even when a formula was given. It now says why:
Exception audit
Users meet only
InputErrorandDeliveryError. The remainingTypeErrors are argument-type checks (standard Python), theAssertionErrors belong to the reference-fixture comparison helper, and the internalValueErrors (formula parser, least squares, calibration timestamps, mix entry) are caught and re-raised as FlahaX errors. No change needed.Behaviour unchanged
The 97-result baseline (26 recipes, 52 complete batches, 19 farmer sessions) is identical. 537 tests with live PHREEQC required;
tools/verify_distribution.pyPASS; no 3.12-only f-strings; LF.