Skip to content

feat(builder): aggregate validation errors in StreamBuilder.validate() (#631) - #678

Open
ZacLou wants to merge 2 commits into
conduit-protocol:mainfrom
ZacLou:fix/631-aggregate-validation-errors
Open

feat(builder): aggregate validation errors in StreamBuilder.validate() (#631)#678
ZacLou wants to merge 2 commits into
conduit-protocol:mainfrom
ZacLou:fix/631-aggregate-validation-errors

Conversation

@ZacLou

@ZacLou ZacLou commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Closes #631.

Replaces the early-exit missing-parameter check in build() with a validate() method that collects every problem before throwing a single ValidationError carrying an .issues[] array.

Changes

  • New StreamBuilder.validate(): returns all current validation issues (missing token, sender, recipient, amount) as a string[]; empty array means valid.
  • Updated build(): calls validate() and raises ValidationError when issues exist, so a builder missing multiple required fields surfaces every problem at once instead of stopping at the first.
  • New ValidationError class (src/errors.ts): exposes readonly issues: string[] and a summary message. Added to isConduitError() recognition list.
  • Tests: existing missing-field assertions updated to check the specific single-field message; new test covers the aggregate behaviour when no fields are set at all.

ZacLou and others added 2 commits September 5, 2026 19:16
Instead of throwing on the first missing field, collect all issues and
throw a single ValidationError with a .issues[] array. Callers can now
see all problems at once instead of fixing them one at a time.

- Added ValidationError class with issues: string[]
- Modified build() to collect all missing required fields
- Exported ValidationError from the package entry point

Addresses conduit-protocol#631
… upstream merge (conduit-protocol#631)

- Export ValidationError from errors.ts and re-export from package index.
- Add StreamBuilder.validate() to collect missing-field issues.
- Fix nested test regression in builder.test.ts (missing it() close).
- Align builder-create-stream-args and network-drop tests with aggregated validation message format.
- All lint/typecheck/tests pass locally.
@ZacLou
ZacLou force-pushed the fix/631-aggregate-validation-errors branch from 8df17f7 to 02a6999 Compare September 5, 2026 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

StreamBuilder: aggregate validation errors

2 participants