errors: validation helpers + contract/spread builders → Error::InvalidArgument (#584)
* errors: validation helpers + contract/spread builders → Error::InvalidArgument
PR-1 of plans/error-variants-audit.md. Flip the 9 helpers in
src/common/error_helpers.rs (require, require_with, require_request_id*,
require_range, require_not_empty*, map_error*) from Error::Simple to
Error::InvalidArgument so the variant matches the kind of failure. Also
convert the 6 ContractBuilder::build validation sites and the 1
SpreadBuilder::build site that mirror the same shape.
Updates 2 downstream tests in accounts/common/stream_decoders/tests.rs
(matches! pattern) and the 8 Display-string assertions in the contract /
spread builder tests (prefix shifts from "error occurred:" to
"InvalidArgument:").
Verified default + sync + all-features clippy and test sweeps.
* tests: pattern-match Error::InvalidArgument with msg guard (/simplify)
Replace 8 brittle to_string() Display-string assertions in
contracts/{builders,common/contract_builder}/tests.rs with the
matches!(err, Error::InvalidArgument(ref msg) if msg == ...) form
already used in error_helpers tests and the sibling stream_decoders
tests. Decouples from the Error variant's #[error(...)] attribute. W
Wil Boayue committed
b644bf02b205742a0f288a5aa358a1102fc4cc5d
Parent: 860a192
Committed by GitHub <noreply@github.com>
on 5/18/2026, 3:17:30 AM