Z. Chi
Z. Chi

Reputation: 11

How can I stop printing the error message "Can't parse message of type because it is missing required fields" with protobuf3

I just want to parse an instance from a string when logging something, and don't care the result.

But when I update protobuf to 3.5.0, the annoying message is always printing to the terminal (stderr):

“Can't parse message of type because it is missing required fields”

Its fields must be required.

How can I stop printing the error message?

Upvotes: 0

Views: 801

Answers (2)

jpa
jpa

Reputation: 12176

As far as I know, the protobuf library itself doesn't directly print to stderr. Instead, error messages are returned through the API like message->InitializationErrorString().

So it seems it is your own code that is printing this message to stderr, or perhaps you have enabled some debug mode.

You can try to add a debugger hook to the print to see where it is coming from.

Upvotes: 0

Marc Gravell
Marc Gravell

Reputation: 1063774

Options:

  • make it optional instead of required
  • provide the missing data
  • hook stderr and send it to nul

Upvotes: 0

Related Questions