def GetChannel(request, context): try: return json_format.Parse( cygrpc.channelz_get_channel(request.channel_id), _channelz_pb2.GetChannelResponse(), ) except ValueError as e: context.set_code(grpc.StatusCode.NOT_FOUND) context.set_details(str(e)) except json_format.ParseError as e: context.set_code(grpc.StatusCode.INTERNAL) context.set_details(str(e))