pub enum Error {
    Command(&'static stri32bool),
    Generic(String),
    Io(Error),
    Manifest(&'static str),
    Mustache(Error),
    Uuid(Error),
    Version(SemVerError),
    Xml(Error),
    XPath(ExecutionError),
}
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 stri32bool)

Tuple Fields

0: &'static str
1: i32
2: bool

A command operation failed.

Generic(String)

Tuple Fields

0: String

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

Io(Error)

Tuple Fields

0: Error

An I/O operation failed.

Manifest(&'static str)

Tuple Fields

0: &'static str

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

Mustache(Error)

Tuple Fields

0: Error

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

Uuid(Error)

Tuple Fields

0: Error

UUID generation or parsing failed.

Version(SemVerError)

Tuple Fields

Parsing error for a version string or field.

Xml(Error)

Tuple Fields

0: Error

Parsing the intermediate WiX Object (wixobj) file, which is XML, failed.

XPath(ExecutionError)

Tuple Fields

Evaluation of an XPath expression failed.

Implementations

Gets an error code related to the error.

Examples
use wix::Error;

let err = Error::from("A generic error");
assert_ne!(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
use std::io;
use std::path::Path;
use wix::Error;

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
use std::io;
use std::path::Path;
use wix::Error;

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));

Extracts a short, single word representation of the error.

The std::error::Error::description method is “soft-deprecated” according to the Rust stdlib documentation. It is recommended to use the std::fmt::Display implementation for a “description” string. However, there is already a std::fmt::Display implemenation for this error type, and it is nice to have a short, single word representation for nicely formatting errors to humans. This method maintains the error message formatting.

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()

The lower-level source of this error, if any. Read more

🔬 This is a nightly-only experimental API. (backtrace)

Returns a stack backtrace, if available, of where this error occurred. Read more

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

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

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Converts a reference to Self into a dynamic trait object of Fail.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the “name” of the error. Read more

Returns a reference to the underlying cause of this failure, if it is an error that wraps other errors. Read more

Returns a reference to the Backtrace carried by this failure, if it carries one. Read more

Provides context for this failure. Read more

Wraps this failure in a compatibility wrapper that implements std::error::Error. Read more

Performs the conversion.

Performs the conversion.

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.