pub enum Error {
CargoMetadata(Error),
Command(&'static str, i32, bool),
Generic(String),
Io(Error),
Manifest(&'static str),
Mustache(Error),
Uuid(Error),
Version(Error),
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§
CargoMetadata(Error)
Parsing of Cargo metadata failed.
Command(&'static str, i32, bool)
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.
Uuid(Error)
UUID generation or parsing failed.
Version(Error)
Parsing error for a version string or field.
Xml(Error)
Parsing the intermediate WiX Object (wixobj) file, which is XML, failed.
XPath(ExecutionError)
Evaluation of an XPath expression failed.
Implementations§
Source§impl Error
impl Error
Sourcepub fn code(&self) -> i32
pub fn code(&self) -> i32
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.
Sourcepub fn already_exists(p: &Utf8Path) -> Self
pub fn already_exists(p: &Utf8Path) -> Self
Creates a new Error from a std::io::Error with the
std::io::ErrorKind::AlreadyExists variant.
§Examples
use std::io;
use camino::Utf8Path;
use wix::Error;
let path = Utf8Path::new("C:\\");
let expected = Error::Io(io::Error::new(
io::ErrorKind::AlreadyExists,
path.to_string()
));
assert_eq!(expected, Error::already_exists(path));Sourcepub fn not_found(p: &Path) -> Self
pub fn not_found(p: &Path) -> Self
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));Sourcepub fn not_a_file(p: &Path) -> Self
pub fn not_a_file(p: &Path) -> Self
Creates a new Error from a std::io::Error with the
std::io::ErrorKind::InvalidInput variant if a path is not a file.
§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::InvalidInput,
format!("The '{}' path is not a file.", path.display())
));
assert_eq!(expected, Error::not_a_file(path));Sourcepub fn not_a_manifest(p: &Path) -> Self
pub fn not_a_manifest(p: &Path) -> Self
Creates a new Error from a std::io::Error with the
std::io::ErrorKind::InvalidInput variant if a path is not to a
Cargo.toml file.
§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::InvalidInput,
format!(
"The '{}' path does not appear to be to a 'Cargo.toml' file.",
path.display(),
),
));
assert_eq!(expected, Error::not_a_manifest(path));Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
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 implementation 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§
Source§impl Error for Error
impl Error for Error
Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§fn source(&self) -> Option<&(dyn StdError + 'static)>
fn source(&self) -> Option<&(dyn StdError + 'static)>
Source§impl From<ExecutionError> for Error
impl From<ExecutionError> for Error
Source§fn from(err: ExecutionError) -> Self
fn from(err: ExecutionError) -> Self
Source§impl From<StripPrefixError> for Error
impl From<StripPrefixError> for Error
Source§fn from(err: StripPrefixError) -> Self
fn from(err: StripPrefixError) -> Self
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl !UnwindSafe for Error
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more