class documentation

Extended request status that includes parsed service errors.

This supplements RequestStatus with a list of domain-specific ServiceError messages extracted from the status details.

Class Method from_rpc_status Construct an extended status by extracting ServiceError protos.
Method __str__ Render a compact human-readable representation of the status.
Method is_retriable Return True when the status is considered retriable.
Method to_rpc_status Convert this extended status back into a protobuf Status.
Instance Variable code gRPC status code
Instance Variable details list of google.protobuf.Any detail messages
Instance Variable message human readable message (may be None)
Instance Variable request_id request identifier extracted from metadata
Instance Variable service_errors list of parsed ServiceError messages
Instance Variable trace_id trace identifier extracted from metadata
Method _extended_state Undocumented
Class Variable _original_extended_state Undocumented

Inherited from RequestStatus:

Class Variable registry Undocumented
Method _localized_details Undocumented
Method _state Undocumented
Class Variable _original_state Undocumented
Class Variable _raw_status Undocumented
@classmethod
def from_rpc_status(cls, status: object, request_id: str, trace_id: str, *, registry: Registry | None = None) -> RequestStatusExtended: (source)

Construct an extended status by extracting ServiceError protos.

This function uses internal helper pb2_from_status to remove service error protos from the details and returns them as ServiceError messages.

def __str__(self) -> str: (source)

Render a compact human-readable representation of the status.

This is used when building exception messages for RequestError.

def is_retriable(self, deadline_retriable: bool = False) -> bool: (source)

Return True when the status is considered retriable.

Retriability is determined by inspecting service-level retry hints and a set of default gRPC status codes. When deadline_retriable is True the DEADLINE_EXCEEDED code is considered retriable.

def to_rpc_status(self, *, registry: Registry | None = None) -> Any: (source)

Convert this extended status back into a protobuf Status.

Service errors are packed into Any messages and included in the returned Status details.

list of google.protobuf.Any detail messages

message: str | None = (source)

human readable message (may be None)

request_id: str = (source)

request identifier extracted from metadata

service_errors: list[Any] = (source)

list of parsed ServiceError messages

trace_id: str = (source)

trace identifier extracted from metadata

def _extended_state(self) -> tuple[tuple[StatusCode, str | None, tuple[bytes, ...]], tuple[bytes, ...]]: (source)

Undocumented

_original_extended_state: tuple[tuple[StatusCode, str | None, tuple[bytes, ...]], tuple[bytes, ...]] | None = (source)

Undocumented