feat: add structured GuildPassErrorCode to BatchItemResult error entries - #435
feat: add structured GuildPassErrorCode to BatchItemResult error entries#435mr-abims wants to merge 2 commits into
Conversation
|
This PR cannot be merged automatically because it has merge conflicts and one or more workflow checks failed. Please update the branch with the latest base branch, resolve the conflicts, and fix the failing workflow checks. After the conflicts are resolved and checks pass, the automation can review it again. |
|
This PR cannot be merged automatically because one or more workflow checks failed. Please review the failed checks, push a fix, and wait for the workflows to pass. After the checks pass and there are no merge conflicts, the automation can review it again. |
|
This PR cannot be merged automatically because it has merge conflicts and one or more workflow checks failed. Please update the branch with the latest base branch, resolve the conflicts, and fix the failing workflow checks. After the conflicts are resolved and checks pass, the automation can review it again. |
Description
Adds
code: GuildPassErrorCodeto every{ status: 'error' }entry inBatchItemResult[](frombatchEthCall,getMembershipTokenBalancesBatch,getGuildOwnersBatch), so callers can branch on failure type per item instead of string-matching. Codes are consistent across all three batch strategies: revert →HTTP_ERROR, unusable response →INVALID_RESPONSE, quorum failure →CONSENSUS_MISMATCH. Allerrorstrings are unchanged; the type change is purely additive.Also fixes a latent bug found along the way:
WS_CONNECTION_ERRORwas referenced inwebSocketProvider.tsbut never declared on the enum, so WS errors carriedcode: undefined.Semver impact: minor
Linked Issue
Closes #390
Type of Change
Changes Made
src/contracts/contract.types.ts— add optionalcodetoBatchItemResultsrc/contracts/batchErrors.ts,src/errors/toErrorCode.ts(new) — error-entry constructor, code extraction, and normalisation of third-party provider results (fallbackUNKNOWN_ERROR)src/contracts/contractClient.ts,providers/*,adapters/*— attach codes on every per-item failure path; three sites that swallowed the caught error's code now propagate itsrc/errors/errorCodes.ts— declare missingWS_CONNECTION_ERRORtests/batch-item-error-codes.test.ts,tests/error-code-integrity.test.ts(new) + updated batch test assertionsdocs/api-reference.md—BatchItemResultsection with code table and branching example;CHANGELOG.md; regenerated api-reportPublic API Changes
Test Evidence
Build Evidence
Checklist
pnpm typecheckpassespnpm lintpassespnpm test:runpasses — all tests greenpnpm buildsucceeds —dist/generated cleanlydocs/updated if public API changedexamples/updated if new usage patterns were addedAdditional Notes