Problem
When the primary JSON file loads but fails the caller's custom validate function, wisp falls through to the fallback file as if the primary were missing. Validation failure and load failure are different cases: the caller asked to reject invalid data, and silently returning the fallback's data hides that.
Found during the release-docs backfill (#32), which documented the actual error message format.
Fix
Use the fallback only when the primary file can't be read or parsed (missing, unreadable, invalid JSON). A validation failure on the primary should throw the validation error. If the current behaviour is wanted for some callers, add an explicit option such as fallbackOnValidationError defaulting to false, and document it. Add tests for both wisp and wispSync.
Problem
When the primary JSON file loads but fails the caller's custom
validatefunction, wisp falls through to thefallbackfile as if the primary were missing. Validation failure and load failure are different cases: the caller asked to reject invalid data, and silently returning the fallback's data hides that.Found during the release-docs backfill (#32), which documented the actual error message format.
Fix
Use the fallback only when the primary file can't be read or parsed (missing, unreadable, invalid JSON). A validation failure on the primary should throw the validation error. If the current behaviour is wanted for some callers, add an explicit option such as
fallbackOnValidationErrordefaulting tofalse, and document it. Add tests for bothwispandwispSync.