wrap_system

Function wrap_system 

Source
pub fn wrap_system<S: Into<Cow<'static, str>> + 'static, E: Into<Box<dyn Error + Send + Sync + 'static>> + 'static>(
    inner: E,
    message: S,
    advice: &'static [&'static str],
) -> Error
Expand description

An error triggered by the system rather than the user, with a deeper cause.

Constructs a new Error describing a failure which was the result of a failure in the system, rather than a user’s action. This error includes a description of what occurred, as well as some advice for the user to try to mitigate the problem. It also includes the details of another error which resulted in this failure.

NOTE: The internal error may be any type which may be converted into a Box.

§Examples

use human_errors;
human_errors::wrap_system(
 human_errors::user("The configuration file was not found.", &["Make sure that the file exists and try again."]),
 "We could not open the config file you provided.",
 &["Make sure that the file exists and is readable by the application."],
);