Enum gen_epub_book::Error
[−]
[src]
pub enum Error { Io { desc: &'static str, op: &'static str, more: Option<&'static str>, }, Parse { tp: &'static str, wher: &'static str, more: Option<&'static str>, }, FileNotFound { who: &'static str, path: PathBuf, }, WrongFileState { what: &'static str, path: PathBuf, }, WrongElementAmount { element: &'static str, actual: usize, relation: &'static str, bound: usize, }, RequiredElementMissing(&'static str), }
Enum representing all possible ways the application can fail.
Variants
Io
An I/O error occured.
This includes higher-level I/O errors like FS ones.
Fields of Io
desc: &'static str | The file the I/O operation regards. |
op: &'static str | The failed operation. This should be lowercase and imperative ("create", "open"). |
more: Option<&'static str> | Additional data. |
Parse
A parsing error occured.
Fields of Parse
tp: &'static str | What failed to parse. Something like "URL", "datetime". |
wher: &'static str | Where the thing that failed to parse would go, were it to parese properly. |
more: Option<&'static str> | Additional data. |
FileNotFound
A requested file doesn't exist.
Fields of FileNotFound
who: &'static str | What requested the file. |
path: PathBuf | The file that should exist. |
WrongFileState
A path is in a wrong state.
Fields of WrongFileState
what: &'static str | What the file is not. |
path: PathBuf | The file that should be. |
WrongElementAmount
An incorrect amount of book elements.
Fields of WrongElementAmount
element: &'static str | The element's name. |
actual: usize | Current amount. |
relation: &'static str | How it should be. |
bound: usize | What it should be. |
RequiredElementMissing(&'static str)
A required book element is missing.
Methods
impl Error
[src]
fn print_error<W: Write>(&self, err_out: &mut W)
[src]
Write the error message to the specified output stream.
Examples
let mut out = Vec::new(); Error::Io { desc: "network", op: "write", more: Some("full buffer"), }.print_error(&mut out); assert_eq!(String::from_iter(out.iter().map(|&i| i as char)), "Writing network failed: full buffer.\n".to_string());
fn exit_value(&self) -> i32
[src]
Get the executable exit value from an Error
instance.
Examples
assert_eq!(Error::Io { desc: "", op: "", more: None, }.exit_value(), 1);
Trait Implementations
impl Debug for Error
[src]
impl Clone for Error
[src]
fn clone(&self) -> Error
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Hash for Error
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl PartialEq for Error
[src]
fn eq(&self, __arg_0: &Error) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Error) -> bool
[src]
This method tests for !=
.