nats.rs icon indicating copy to clipboard operation
nats.rs copied to clipboard

Refactor ParseError

Open nepalez opened this issue 10 months ago • 0 comments

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

nepalez avatar Aug 14 '23 19:08 nepalez