owengage / fastnbt

Fast serde serializer and deserializer for Minecraft's NBT and Anvil formats
MIT License
186 stars 34 forks source link

Stream parser: distinguish errors #36

Closed owengage closed 3 years ago

owengage commented 3 years ago

The error types don't really expose any internal details about the error that occurred. For the serde parser this is quite reasonable since it either deserializes or it doesn't. There isn't much inbetween and there isn't much programatic recovery to be done.

The stream parser however, the user can decide how to react to certain errors. For example, a non-unicode string might be found. The user could decide to continue parsing after this point. This means being able to distinguish these errors would be useful.

Adding a 'kind' method or some sort similar to std::io::Error might help.

owengage commented 3 years ago

Added in 1.2.0

owengage commented 3 years ago

@DuckDuckWhale, as you suggested. :)