Skip to content

blackbull.grpc.status

blackbull.grpc.status

gRPC canonical status codes and the error type handlers raise.

The codes are the gRPC/google.rpc canonical set (https://grpc.github.io/grpc/core/md_doc_statuscodes.html). They travel on the wire as the decimal grpc-status trailer; OK (0) signals success.

GrpcError

Bases: Exception

Raised by a service handler (or context.abort) to end the RPC with a non-OK status. serve_grpc translates it into grpc-status / grpc-message trailers.

GrpcStatus

Bases: IntEnum

The canonical gRPC status codes, as the grpc-status trailer carries them.

OK (0) is success; every other member ends the RPC. Raise one through GrpcError — that is the typed contract a handler is checked against, so a bare integer is a caller error rather than an unnamed code.