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.
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.