Skip to content

Improve and test startup config validation error messages #240

Description

@Lakes41

Difficulty: Intermediate
Type: bug

Background
The README states the app uses a typed configuration layer validating EXPO_PUBLIC_API_URL and EXPO_PUBLIC_CHAIN_ID at startup, throwing a "clear developer-facing error in development" if they're missing or invalid, to prevent silent fallback to production defaults.

Problem
It's not verified that these error messages are actually specific and actionable (naming the exact variable and what's wrong with it) rather than a generic "invalid config" message, and there's no indication this validation logic is covered by unit tests.

Expected outcome
Each config validation failure (missing EXPO_PUBLIC_API_URL, malformed URL, missing EXPO_PUBLIC_CHAIN_ID, non-numeric/invalid chain ID) throws a distinct, specific error identifying the variable and the problem, and this logic has unit test coverage for every case.

Suggested implementation

  • Locate the config validation module (likely src/ or a root config.ts) and review current error messages for specificity.
  • Rewrite generic error messages to name the exact variable and expected format/value.
  • Add a test file covering: missing EXPO_PUBLIC_API_URL, malformed URL, missing EXPO_PUBLIC_CHAIN_ID, non-numeric chain ID, and the valid/passing case.
  • Verify the error is dev-only (not shown/thrown in a way that would crash a production build if config were somehow correct at build time but the check redundantly ran).

Acceptance criteria

  • Each invalid config case produces a distinct, specific error message
  • Unit tests cover the full validation matrix
  • Valid configuration passes without any warnings

Likely affected files/directories

  • src/ (config validation module)
  • tests/

Metadata

Metadata

Assignees

Labels

GrantFox OSSGrantFox Open Source Sponsorship program tagMaybe RewardedIssue may qualify for a reward upon successful completion per campaign rulesOfficial Campaign | FWC26Official FWC26 campaign issue — eligible for campaign scoring and rewardsbugConfirmed defect or incorrect behavior that needs to be fixedintermediateIntermediate difficulty tasks requiring solid experience and some context

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions