Refactor NETCONF RPC error handling#34
Merged
Merged
Conversation
Contributor
Author
|
Ah, the test is failing because this also depends on the xml.Node improvements in stdlib. |
NetconfError remains the main exception class, containing an optional summary message and a list of RpcError objects. A response may contain multiple rpc-error elements. RpcError encapsulates an individual rpc-error XML element with all RFC-defined fields parsed into typed attributes. It also preserves raw XML for optional vendor extensions. Callback signatures were refined based on whether operations return data. Operations that only return ok or error (edit-config, commit, discard-changes, lock, unlock) use action(Client, ?NetconfError) while operations returning data (get, get-config, get-schema) use action(Client, ?xml.Node, ?NetconfError). The generic rpc-reply handler now properly distinguishes between three response types: ok-only responses where ok must be the sole child element, error responses containing one or more rpc-error elements, and normal data responses. Empty rpc-reply elements are treated as errors since they violate the protocol specification.
3ff457b to
d4a2943
Compare
Contributor
Author
|
I changed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
NetconfError remains the main exception class, containing an optional summary message and a list of RpcError objects. A response may contain multiple rpc-error elements. RpcError encapsulates an individual rpc-error XML element with all RFC-defined fields parsed into typed attributes. It also preserves raw XML for optional vendor extensions.
Callback signatures were refined based on whether operations return data. Operations that only return ok or error (edit-config, commit, discard-changes, lock, unlock) use action(Client, ?NetconfError) while operations returning data (get, get-config, get-schema) use action(Client, ?xml.Node, ?NetconfError).
The generic rpc-reply handler now properly distinguishes between three response types: ok-only responses where ok must be the sole child element, error responses containing one or more rpc-error elements, and normal data responses. Empty rpc-reply elements are treated as errors since they violate the protocol specification.
Closes #33