You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
toon: decode raises ValueError where the contract is ToonDecodeError #198
The cases are malformed input that decode() should reject, so raising is right — but with the wrong type. A caller writing except ToonDecodeError (which is what the module's own docstring and Raises: sections promise) does not catch these; they escape as a bare ValueError.
Found while reconciling numbers for #195: the conformance gate requires ToonDecodeError specifically on the 158 shouldError decode cases, which is the stricter and correct reading. Under that rule the module is at 225/404 on decode, not 234/404 — my earlier figure on #184 accepted any exception. All nine are currently inside toon/conformance_baseline.json, so the gate tolerates them; that is the ratchet working as designed, not an endorsement.
Fix
Make the decode paths that raise bare ValueError raise ToonDecodeError instead — likely the same places that treat validation failures as generic value errors. Then shrink the baseline by those nine IDs, which is the mechanism #195 provides.
Worth doing while the module's version is already moving for the spec work, since it is an API-visible contract rather than a spec gap.
Activity
fix(toon): raise ToonDecodeError, not ValueError, on invalid escapes