sharksforarms / deku

Declarative binary reading and writing: bit-level, symmetric, serialization/deserialization
Apache License 2.0
1.11k stars 54 forks source link

Feature request: Have DekuError give position of errors when possible #347

Open typedrat opened 1 year ago

typedrat commented 1 year ago

Unfortunately, the smallest example I have of the binary format I am currently trying to parse is several megabytes in size, and so it is very hard to find the exact location of an error like Parse error: Missing magic value [80, 71] when this occurs at the start of each of several thousand records.

I haven't looked into the implementation, but based on my experience working with parsers it shouldn't be especially hard to add at the very least a byte offset into the input at which the error occurred.