How to send error details like as BadRequest

两盒软妹~` 提交于 2021-01-29 16:32:35

问题


I need send rich structured error details on gRPC error.

I think it's maybe like this:

fv = BadRequest.FieldViolation(field="login", description="Name is not unique")
bad_request = BadRequest(field_violations=[fv])
context.abort(StatusCode.INVALID_ARGUMENT, bad_request.SerializeToString())

But is's wrong and send bytes in summary error text.

I use grpcio==1.17.1


回答1:


I got feedback on github issue https://github.com/grpc/grpc/issues/17601

Everything works in version 1.18.0



来源:https://stackoverflow.com/questions/53781871/how-to-send-error-details-like-as-badrequest

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!