Skip to content
ocx
install

WhichResult, error_envelope

WhichResultclassdataclass#

Re-exported from ocx_sdk._resultsView source
class WhichResult(path: str, kind: str)

Where one identifier resolves on disk, per package which.

Attributes

NameTypeDescription
pathstrThe resolved location.
kindstr"package" for a store directory, "shim" for a shim.

kindattributeinstance attribute#

kind: str

pathattributeinstance attribute#

path: str

from_dictmethodclassmethod#

def from_dict(data: Mapping[str, Any]) -> WhichResult

Build from one decoded value of the keyed object.

error_envelopefunction#

Re-exported from ocx_sdk._resultsView source
def error_envelope(error: OcxProcessError) -> ErrorEnvelope | None

Return the structured failure a non-zero exit carried, else None.

The dual of partial_report: where that recovers the report a report-then-fail command wrote, this recovers the envelope a hard failure wrote instead. A failure never carries both, so for any one error at most one of the two answers.

try:
ocx.package.claim("acme/widget", repository="oci://ghcr.io/acme/widget")
except DataError as exc:
envelope = error_envelope(exc)
if envelope is None or "already claimed" not in envelope.message:
raise

Parameters

NameTypeDescription
errorOcxProcessErrorThe caught process failure.

Returns

ErrorEnvelope | None
None when stdout is empty, is not JSON, or is a report rather than
ErrorEnvelope | None
an envelope. Otherwise the parsed envelope.

Raises

ValueError
stdout is an envelope missing one of its frozen keys — a binary outside the tested window, not a recoverable state.