-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9c3a37f
commit 9a96133
Showing
6 changed files
with
54 additions
and
76 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,20 @@ | ||
use super::xml::RPCError; | ||
use crate::netconf::RPCReplyCommand; | ||
|
||
#[derive(Debug)] | ||
#[derive(Debug, thiserror::Error)] | ||
pub enum NETCONFError { | ||
IoError(std::io::Error), | ||
XmlError(quick_xml::Error), | ||
XmlDeError(quick_xml::DeError), | ||
#[error("{0}")] | ||
IoError(#[from] std::io::Error), | ||
#[error("{0}")] | ||
XmlError(#[from] quick_xml::Error), | ||
#[error("{0}")] | ||
XmlDeError(#[from] quick_xml::DeError), | ||
#[error("Missing OK")] | ||
MissingOk, | ||
#[error("Unexpected command: {0}")] | ||
UnexpectedCommand(RPCReplyCommand), | ||
RpcError(RPCError), | ||
#[error("{0}")] | ||
RpcError(#[from] RPCError), | ||
} | ||
|
||
pub type NETCONFResult<T> = Result<T, NETCONFError>; | ||
|
||
impl From<std::io::Error> for NETCONFError { | ||
fn from(err: std::io::Error) -> Self { | ||
NETCONFError::IoError(err) | ||
} | ||
} | ||
|
||
impl From<quick_xml::Error> for NETCONFError { | ||
fn from(err: quick_xml::Error) -> Self { | ||
NETCONFError::XmlError(err) | ||
} | ||
} | ||
|
||
impl From<quick_xml::DeError> for NETCONFError { | ||
fn from(err: quick_xml::DeError) -> Self { | ||
NETCONFError::XmlDeError(err) | ||
} | ||
} | ||
|
||
impl From<RPCError> for NETCONFError { | ||
fn from(err: RPCError) -> Self { | ||
NETCONFError::RpcError(err) | ||
} | ||
} |
This file contains 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
This file contains 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