1#[derive(thiserror::Error, Debug, Clone, PartialEq, Eq)]
2pub enum CommandError {
3 #[error("The option `{0}` expects a value")]
4 Custom(String),
5
6 #[error("Missing required option argument")]
7 MissingOptionArguments,
8
9 #[error("Unsupported option name")]
10 UnknownOption,
11
12 #[error("Invalid option name")]
13 InvalidOption,
14
15 #[error("Missing required positional argument")]
16 MissingPositionalArguments,
17
18 #[error("Extraneous positional arguments")]
19 ExtraneousPositionalArguments,
20}
21
22#[derive(thiserror::Error, Debug, Clone, PartialEq, Eq)]
23pub enum Error {
24 #[error("The provided arguments are ambiguous and need to be refined further. Possible options are:")]
25 AmbiguousSyntax(Vec<usize>),
26
27 #[error("{1}")]
28 CommandError(usize, CommandError),
29
30 #[error("Something unexpected happened; this seems to be a bug in the CLI framework itself")]
31 InternalError,
32
33 #[error("The provided arguments don't match any known syntax; use `--help` to get a list of possible options")]
34 NotFound(Vec<usize>),
35}
36
37#[derive(thiserror::Error, Debug)]
38pub enum BuildError {
39 #[error("Commands can only define a single rest parameter")]
40 MultipleRestParameters,
41
42 #[error("Commands aren't allowed to define optional parameters after a rest parameter")]
43 OptionalParametersAfterRest,
44
45 #[error("Commands aren't allowed to define optional parameters after trailing positionals")]
46 OptionalParametersAfterTrailingPositionals,
47
48 #[error("Commands aren't allowed to define rest parameters after trailing positionals")]
49 RestAfterTrailingPositionals,
50
51 #[error("TODO: I don't remember the details of this error right at this moment")]
52 ArityTooHighForNonBindingOption,
53}