Skip to content

Reference

Utils — contract read diagnostics

Classify ledger read failures, map them to OcpErrorCodes, attach structured context, and build OcpContractError instances with diagnostics for extractors and readers.

Utilities in contractReadDiagnostics interpret arbitrary thrown values from Canton JSON API reads and normalize them for retry, benign missing, and error code selection.

Key exports

  • classifyContractReadFailure(error)'not_found' | 'visibility' | 'auth' | 'schema' | 'network' | 'unknown'
  • analyzeContractReadFailure(error){ classification, retryable, benignMissing }
  • contractReadFailureCode(kind) → maps to OcpErrorCodes
  • createDiagnosedContractReadErrorOcpContractError with diagnostics object attached (and cause)
  • isRetryableContractReadFailure — HTTP 429 / 502 / 503 / 504 heuristics
  • contractReadDiagnosticsToOcpContext — shape context for OcpError.context

When used

extractCantonOcfManifest uses these helpers to decide whether to throw, retry, or skip archived contracts.

See also

Source