Skip to content

A failed custom validation also loads the fallback file #33

Description

@Shinrai

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.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreTouches core library / runtime source codepriority: mediumShould be addressed in the normal course of developmentstatus: implementedBuilt and deployed, but not yet fully tested/verifiedtype: bugSomething is broken or not behaving as expected

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions