![](/img/trans.png)
[英](ProtoBuf) Can't parse message of type “data.Data” because it is missing required fields: ID
[英]How can I stop printing the error message “Can't parse message of type because it is missing required fields” with protobuf3
我只想在記錄某些內容時從字符串中解析一個實例,而不關心結果。
但是,當我將protobuf更新為3.5.0時,煩人的消息始終會打印到終端(stderr):
“無法分析類型的消息,因為它缺少必填字段”
必須填寫其字段。
如何停止打印錯誤消息?
選項:
optional
而不是required
stderr
並將其發送給nul
據我所知,protobuf庫本身並不直接打印到stderr。 而是通過API返回錯誤消息,例如message->InitializationErrorString()
。
因此,似乎是您自己的代碼將此消息打印到stderr,或者您已啟用某些調試模式。
您可以嘗試將調試器掛鈎添加到打印中,以查看其來源。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.