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

An I/O error occured.

This includes higher-level I/O errors like FS ones.

Fields of Io

The file the I/O operation regards.

The failed operation.

This should be lowercase and imperative ("create", "open").

Additional data.

A parsing error occured.

Fields of Parse

What failed to parse.

Something like "URL", "datetime".

Where the thing that failed to parse would go, were it to parese properly.

Additional data.

A requested file doesn't exist.

Fields of FileNotFound

What requested the file.

The file that should exist.

A path is in a wrong state.

Fields of WrongFileState

What the file is not.

The file that should be.

An incorrect amount of book elements.

Fields of WrongElementAmount

The element's name.

Current amount.

How it should be.

What it should be.

A required book element is missing.

Methods

impl Error
[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());

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]

Formats the value using the given formatter.

impl Clone for Error
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Hash for Error
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl PartialEq for Error
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for Error
[src]