[][src]Enum bloguen::Error

pub enum Error {
    Io {
        desc: Cow<'static, str>,
        op: &'static str,
        more: Cow<'static, str>,
    },
    Parse {
        tp: &'static str,
        wher: Cow<'static, str>,
        more: Cow<'static, str>,
    },
    FileNotFound {
        who: &'static str,
        path: Cow<'static, str>,
    },
    WrongFileState {
        what: &'static str,
        path: Cow<'static, str>,
    },
    FileParsingFailed {
        desc: Cow<'static, str>,
        errors: Cow<'static, str>,
    },
}

Enum representing all possible ways the application can fail.

Examples

assert_eq!(Error::Io {
               desc: "network".into(),
               op: "write",
               more: "full buffer".into(),
           }.to_string(),
           "Writing network failed: full buffer.");

Variants

Io

An I/O error occured.

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

Fields of Io

desc: Cow<'static, str>

The file the I/O operation regards.

op: &'static str

The failed operation.

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

more: Cow<'static, str>

Additional data.

Parse

Fields of Parse

tp: &'static str

What failed to parse.

Something like "URL", "datetime".

wher: Cow<'static, str>

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

more: Cow<'static, str>

Additional data.

FileNotFound

A requested file doesn't exist.

Fields of FileNotFound

who: &'static str

What requested the file.

path: Cow<'static, str>

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: Cow<'static, str>

The file that should be.

FileParsingFailed

Failed to parse the specified file because of the specified error(s).

Fields of FileParsingFailed

desc: Cow<'static, str>

The file that failed to parse.

errors: Cow<'static, str>

The parsing error(s) that occured.

Methods

impl Error[src]

pub fn exit_value(&self) -> i32[src]

Get the executable exit value from an Error instance.

Examples

assert_eq!(Error::Io {
    desc: "".into(),
    op: "",
    more: "".into(),
}.exit_value(), 1);

Trait Implementations

impl Eq for Error[src]

impl Clone for Error[src]

impl PartialEq<Error> for Error[src]

impl Hash for Error[src]

impl Debug for Error[src]

impl Display for Error[src]

impl Error for Error[src]

Auto Trait Implementations

impl Send for Error

impl Unpin for Error

impl Sync for Error

impl UnwindSafe for Error

impl RefUnwindSafe for Error

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]