Enum wix::Error

source ·
pub enum Error {
    Command(&'static stri32),
    Generic(String),
    Io(Error),
    Manifest(&'static str),
    Mustache(Error),
    Toml(Error),
    Version(SemVerError),
}
Expand description

The error type for wix-related operations and associated traits.

Errors mostly originate from the dependencies, but custom instances of Error can be created with the Generic variant and a message.

Variants§

§

Command(&'static stri32)

A command operation failed.

§

Generic(String)

A generic or custom error occurred. The message should contain the detailed information.

§

Io(Error)

An I/O operation failed.

§

Manifest(&'static str)

A needed field within the Cargo.toml manifest could not be found.

§

Mustache(Error)

An error occurred with rendering the template using the mustache renderer.

§

Toml(Error)

Parsing of the Cargo.toml manifest failed.

§

Version(SemVerError)

Parsing error for a version string or field.

Implementations§

Gets an error code related to the error.

Examples
extern crate wix;

use wix::Error;

fn main() {
    let err = Error::from("A generic error");
    assert!(err.code() != 0)
}

This is useful as a return, or exit, code for a command line application, where a non-zero integer indicates a failure in the application. it can also be used for quickly and easily testing equality between two errors.

Creates a new Error from a std::io::Error with the std::io::ErrorKind::AlreadyExists variant.

Examples
extern crate wix;

use std::io;
use std::path::Path;
use wix::Error;

fn main() {
    let path = Path::new("C:\\");
    let expected = Error::Io(io::Error::new(
        io::ErrorKind::AlreadyExists,
        path.display().to_string()
    ));
    assert_eq!(expected, Error::already_exists(path));
}

Creates a new Error from a std::io::Error with the std::io::ErrorKind::NotFound variant.

Examples
extern crate wix;

use std::io;
use std::path::Path;
use wix::Error;

fn main() {
    let path = Path::new("C:\\Cargo\\Wix\\file.txt");
    let expected = Error::Io(io::Error::new(
        io::ErrorKind::NotFound,
        path.display().to_string()
    ));
    assert_eq!(expected, Error::not_found(path));
}

Trait Implementations§

Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
👎Deprecated since 1.42.0: use the Display impl or to_string()
👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
The lower-level source of this error, if any. Read more
🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

🔬This is a nightly-only experimental API. (provide_any)
Data providers should implement this method to provide all values they are able to provide by using demand. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.