Open jamesshannon opened 1 year ago
Thanks for raising this. We provide error messages with context for the JSON format, we should consider doing the same for this case.
I had a same issue when constructing a new instant of an message from a plain object and was only told that Error: invalid int 32: string
I've just spend a bunch of time because of a not-very-helpful error message generated by the assert library. Specifically:
However, it provides no message about the field or the value. I eventually modified your code in
writeScalar
to log out the fieldNo, tied this back to the message, and figured out what was going on (see separate FR).I would recommend that this function also print out the field name and the value that it was trying to convert (maybe truncated if over 20 bytes or something). Or, more likely, something upstream like
makeBinaryFormatProto3
, which seems to be the last function which knows the field name, captures the validation error and prints that out.