Difficulty: Hard
Type: Refactor
Summary
Improve validation errors so consumers can identify which input field failed and why without parsing human-readable error strings.
Current Behaviour
Input validation throws GuildPassError, but consumers may need to inspect error messages to determine whether the invalid value was a wallet address, guild ID, resource ID, role ID, chain ID, or configuration field.
Expected Behaviour
Validation errors should include structured metadata such as field, reason, and optionally a safe value or valueType. This allows applications to show precise form errors and log useful diagnostics without brittle string parsing.
Suggested Implementation
Update validation helpers to throw GuildPassError with structured metadata. Add a common validation error helper to keep error shape consistent. Ensure sensitive values are not included directly unless they are safe identifiers such as guild IDs or public wallet addresses. Update tests to assert metadata for common invalid inputs.
Files or Areas Likely Affected
src/utils/validation.ts
src/utils/address.ts
src/config/sdkConfig.ts
src/contracts/contractClient.ts
src/errors/GuildPassError.ts
src/errors/errorCodes.ts
tests/
Acceptance Criteria
Additional Notes
Keep existing error messages readable for humans, but make machine-readable metadata the preferred integration surface.
Difficulty: Hard
Type: Refactor
Summary
Improve validation errors so consumers can identify which input field failed and why without parsing human-readable error strings.
Current Behaviour
Input validation throws
GuildPassError, but consumers may need to inspect error messages to determine whether the invalid value was a wallet address, guild ID, resource ID, role ID, chain ID, or configuration field.Expected Behaviour
Validation errors should include structured metadata such as
field,reason, and optionally a safevalueorvalueType. This allows applications to show precise form errors and log useful diagnostics without brittle string parsing.Suggested Implementation
Update validation helpers to throw
GuildPassErrorwith structured metadata. Add a common validation error helper to keep error shape consistent. Ensure sensitive values are not included directly unless they are safe identifiers such as guild IDs or public wallet addresses. Update tests to assert metadata for common invalid inputs.Files or Areas Likely Affected
src/utils/validation.tssrc/utils/address.tssrc/config/sdkConfig.tssrc/contracts/contractClient.tssrc/errors/GuildPassError.tssrc/errors/errorCodes.tstests/Acceptance Criteria
fieldvalue.fieldvalue.fieldvalue.fieldvalue.apiKey.Additional Notes
Keep existing error messages readable for humans, but make machine-readable metadata the preferred integration surface.