Skip to main content

righ_ovsdb/
result.rs

1#[cfg(feature = "protocol")]
2use crate::protocol::CodecError;
3
4/// This type represents all errors that can occur within OVSDB.
5#[derive(thiserror::Error, Debug)]
6pub enum Error {
7    /// A failure occurrecd while parsing JSON data.
8    #[error("Failed to parse JSON data")]
9    ParseError(#[source] serde_json::Error),
10    /// A provided file path does not exist on disk.
11    #[error("File not found")]
12    FileNotFound(#[source] std::io::Error),
13    /// Unable to open a file due to permissions issues.
14    #[error("Permission denied")]
15    PermissionDenied(#[source] std::io::Error),
16    /// A general IO error occurred while reading data from a file.
17    #[error("Error reading data from file")]
18    ReadError(#[source] std::io::Error),
19    #[cfg(feature = "protocol")]
20    /// A failure occurred while processing communications between client and server.
21    #[error("An error occurred when communicating with the server")]
22    CommunicationFailure(#[from] CodecError),
23}
24
25/// Alias for a [Result][std::result::Result] with the error type [Error].
26pub type Result<T> = std::result::Result<T, Error>;