-
Notifications
You must be signed in to change notification settings - Fork 776
Expand file tree
/
Copy pathconfig_error.rs
More file actions
61 lines (59 loc) · 1.79 KB
/
config_error.rs
File metadata and controls
61 lines (59 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
use super::*;
#[derive(Debug, Snafu)]
#[snafu(visibility(pub(crate)), context(suffix(false)))]
pub(crate) enum ConfigError {
#[snafu(display("failed to get current directory: {}", source))]
CurrentDir { source: io::Error },
#[snafu(display(
"internal config error, this may indicate a bug in just: {message} \
consider filing an issue: https://github.com/casey/just/issues/new",
))]
Internal { message: String },
#[snafu(display("invalid module path `{}`", path.join(" ")))]
ModulePath { path: Vec<String> },
#[snafu(display("invalid override path `{path}`"))]
OverridePath { path: String },
#[snafu(display("failed to parse request: {source}"))]
RequestParse { source: serde_json::Error },
#[snafu(display(
"path-prefixed recipes may not be used with `--working-directory` or `--justfile`"
))]
SearchDirConflict,
#[snafu(display(
"`--{}` used with unexpected {}: {}",
subcommand.to_lowercase(),
Count("argument", arguments.len()),
List::and_ticked(arguments)
))]
SubcommandArguments {
subcommand: &'static str,
arguments: Vec<String>,
},
#[snafu(display(
"`--{}` used with unexpected overrides: {}",
subcommand.to_lowercase(),
List::and_ticked(overrides.iter()),
))]
SubcommandOverrides {
subcommand: &'static str,
overrides: Vec<String>,
},
#[snafu(display(
"`--{}` used with unexpected overrides: {}; and arguments: {}",
subcommand.to_lowercase(),
List::and_ticked(overrides.iter()),
List::and_ticked(arguments)))
]
SubcommandOverridesAndArguments {
subcommand: &'static str,
overrides: Vec<String>,
arguments: Vec<String>,
},
}
impl ConfigError {
pub(crate) fn internal(message: impl Into<String>) -> Self {
Self::Internal {
message: message.into(),
}
}
}