如何发送错误详细信息,例如BadRequest [英] How to send error details like as BadRequest
本文介绍了如何发送错误详细信息,例如BadRequest的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要发送有关gRPC错误的丰富的结构化错误详细信息.
I need send rich structured error details on gRPC error.
我认为可能是这样的
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.
我使用grpcio == 1.17.1
I use grpcio==1.17.1
推荐答案
我收到了有关github问题 https://github.com/grpc/grpc/issues/17601
I got feedback on github issue https://github.com/grpc/grpc/issues/17601
一切正常,版本为1.18.0
Everything works in version 1.18.0
这篇关于如何发送错误详细信息,例如BadRequest的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文