nats.rs
nats.rs copied to clipboard
Refactor ParseError
This PR is a part of error specialization initiated by the https://github.com/nats-io/nats.rs/pull/1047
See the initial discussion of the change in this https://github.com/nats-io/nats.rs/pull/1081 (to be removed later, after processing the feedback by @Jarema and creating smaller PR-s from its commits).
This particular PR is created to follow-up the discussion
In this PR instead of the crate::Error
, the stream::parse_headers
will return the specialized error with kind enumerating the possible causes of parsing errors. This change will help to specialize errors error returned by public methods.
Along this change, I also refactored 2 errors, namely the ParseHeaderNameError
and the ParseHeaderValueError
to convert them to specialization of generic crate::error::Error<_>
.
These changes are collected in the same commit because all of them describe errors occurred during either building or parsing headers.