pub enum Error {
Command(&'static str, i32, bool),
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 str, i32, 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
0: SemVerError
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
Performs the conversion.
Performs the conversion.
Performs the conversion.
Auto Trait Implementations
impl !RefUnwindSafe for Error
impl !UnwindSafe for Error
Blanket Implementations
pub fn as_fail(&self) -> &(dyn Fail + 'static)
pub fn as_fail(&self) -> &(dyn Fail + 'static)
Converts a reference to Self
into a dynamic trait object of Fail
.
Mutably borrows from an owned value. Read more