如何发送错误详细信息,例如 BadRequest
How to send error details like as BadRequest
我需要发送有关 gRPC 错误的丰富的结构化错误详细信息。
我觉得大概是这样的:
fv = BadRequest.FieldViolation(field="login", description="Name is not unique")
bad_request = BadRequest(field_violations=[fv])
context.abort(StatusCode.INVALID_ARGUMENT, bad_request.SerializeToString())
但是错误并在摘要错误文本中发送字节。
我用的是grpcio==1.17.1
我收到了关于 github 问题的反馈 https://github.com/grpc/grpc/issues/17601
版本 1.18.0 一切正常
我需要发送有关 gRPC 错误的丰富的结构化错误详细信息。
我觉得大概是这样的:
fv = BadRequest.FieldViolation(field="login", description="Name is not unique")
bad_request = BadRequest(field_violations=[fv])
context.abort(StatusCode.INVALID_ARGUMENT, bad_request.SerializeToString())
但是错误并在摘要错误文本中发送字节。
我用的是grpcio==1.17.1
我收到了关于 github 问题的反馈 https://github.com/grpc/grpc/issues/17601
版本 1.18.0 一切正常