Skip to content

fix: keep every d.errors[] entry in fromHttpError messages#369

Merged
Lakes41 merged 1 commit into
Adamantine-guild:mainfrom
vreabernardo:fix/fromhttperror-nested-errors
Jul 24, 2026
Merged

fix: keep every d.errors[] entry in fromHttpError messages#369
Lakes41 merged 1 commit into
Adamantine-guild:mainfrom
vreabernardo:fix/fromhttperror-nested-errors

Conversation

@vreabernardo

Copy link
Copy Markdown
Contributor

Closes #191.

An entry in d.errors[] without message/msg/code (e.g. { field: "guildId", issue: "required" }) was silently dropped by the .filter(Boolean), so a 400 response full of validation failures could surface as a bare HTTP Error: 400 with no hint what failed.

Precedence is unchanged (string, message, msg, code), then two new fallbacks: field: issue rendering for validation-shaped entries, and JSON.stringify for anything else. Every entry now contributes something.

Tests: 4 new cases in tests/errors.test.ts (mixed shapes, JSON fallback, single-entry unwrapped, null/non-object tolerance). errors.test.ts 19/19 pass. Full suite: 250 failed / 808 passed vs 250 / 804 on main, failing sets identical (pre-existing failures in contracts/guildId-encoding/compat suites). tsc --noEmit and eslint on the touched files show the same output as main.

…action

Entries without message/msg/code were silently filtered out, hiding
validation failures from callers. Each entry now falls back to
field: issue rendering, then JSON.stringify.

Closes Adamantine-guild#191
@Lakes41
Lakes41 merged commit c8fdc79 into Adamantine-guild:main Jul 24, 2026
1 check passed
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.

Improve GuildPassError.fromHttpError message extraction for nested error arrays

2 participants