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
@classmethod
def from_rpc_status(cls, status: StatusPb, request_id: str, trace_id: str) -> 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 wrappers.

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) -> StatusPb: (source)

Convert this extended status back into a protobuf Status.

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

details: list[AnyPb] = (source)

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[ServiceError] = (source)

list of parsed ServiceError messages

trace_id: str = (source)

trace identifier extracted from metadata