Use Context
suffix for snafu error contexts (#1068)
This commit is contained in:
parent
c89dad9498
commit
edf1fbd83b
@ -416,7 +416,7 @@ impl Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn from_matches(matches: &ArgMatches) -> ConfigResult<Self> {
|
pub(crate) fn from_matches(matches: &ArgMatches) -> ConfigResult<Self> {
|
||||||
let invocation_directory = env::current_dir().context(config_error::CurrentDirSnafu)?;
|
let invocation_directory = env::current_dir().context(config_error::CurrentDirContext)?;
|
||||||
|
|
||||||
let verbosity = if matches.is_present(arg::QUIET) {
|
let verbosity = if matches.is_present(arg::QUIET) {
|
||||||
Verbosity::Quiet
|
Verbosity::Quiet
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use crate::common::*;
|
use crate::common::*;
|
||||||
|
|
||||||
#[derive(Debug, Snafu)]
|
#[derive(Debug, Snafu)]
|
||||||
#[snafu(visibility(pub(crate)))]
|
#[snafu(visibility(pub(crate)), context(suffix(Context)))]
|
||||||
pub(crate) enum ConfigError {
|
pub(crate) enum ConfigError {
|
||||||
#[snafu(display("Failed to get current directory: {}", source))]
|
#[snafu(display("Failed to get current directory: {}", source))]
|
||||||
CurrentDir { source: io::Error },
|
CurrentDir { source: io::Error },
|
||||||
|
Loading…
Reference in New Issue
Block a user