Stone.js API
    Preparing search index...

    Raised when what a handler produced does not match the schema its resource published.

    This is a server-side fault, deliberately. The resource's schema is a promise made to every caller and to the published contract; data that breaks it means the application is about to answer something it documented it would not. Returning it anyway is the failure — a client cannot detect it, and a consumer generated from the contract will break on a field that was supposed to be there.

    It fires on a genuine breach, not on a difference: a schema strips what it does not describe, so extra fields are simply not exposed. Reaching this means something the contract requires is missing or has the wrong type.

    Hierarchy

    • RuntimeError
      • ResourceContractError
    Index
    cause?: Error
    code?: string
    issues: ContractIssue[]

    What failed, so a log says which field rather than "validation failed".

    metadata?: unknown
    • Converts the error to a formatted string representation.

      Parameters

      • Optionalmultiline: boolean

        Determine if output value must be multiline or not.

      Returns string

      A formatted error string.

    • Create a RuntimeError.

      Type Parameters

      • T extends RuntimeError = RuntimeError

      Parameters

      • message: string
      • Optionaloptions: ErrorOptions

        The options to create a RuntimeError.

      Returns T

      A new RuntimeError instance.