google / emboss

Emboss is a tool for generating code that reads and writes binary data structures.
Apache License 2.0
70 stars 21 forks source link

Better Error Messages for Text Format Parsing #27

Open reventlov opened 2 years ago

reventlov commented 2 years ago

UpdateFromText() just returns a bool indicating success/failure. There is currently no way to find out where parsing failed, which makes it difficult to debug manually-written text format structs.

reventlov commented 1 year ago

The implementation of this is probably to update the C++ UpdateFromTextStream() methods to take an optional output parameter, or to build a parallel API like UpdateFromTextStreamOrReturnError(). I haven't given a lot of thought to the best way to actually return the error(s). Right now, the update bails out if there is any error, but I can imagine having an allow_partial_update option similar to the allow_partial_output option for text output, so ideally the API would allow multiple errors to be returned.

A (maybe) comprehensive list of the places that are are likely to need to be changed: