ping-identity
    Preparing search index...

    Function buildMetadataError

    Headless collector normalisation and submit-planning helpers.

    • Builds the structured error envelope for a MetadataCollector result.

      Parameters

      • code: string

        Short error code identifying the failure (e.g. 'USER_CANCELLED').

      • message: string

        Human-readable description of the failure.

      Returns DaVinciMetadataErrorResult

      The { error: { code, message } } envelope to set as the MetadataCollector value.

      The returned object routes the server-side connector to its client-error branch: set it as the collector's form value (via setValue) and resume with next() as usual. The error envelope is the collector's value, which the connector routes on, so a well-formed envelope resolves the flow instead of rejecting the bridge call.

      The envelope carries exactly code and message: extra keys inside the error object pass JS validation but are reconstructed (not forwarded) by the native setError call on both platforms, so additional context belongs in the message string, not in envelope extras.

      form.setValue(
      'sdkMetadata',
      buildMetadataError('USER_CANCELLED', 'User dismissed the challenge.'),
      );
      await next(form.input);