Skip to main content

callisto_cli/
error.rs

1use callisto_graph::locate::LocateError;
2use callisto_graph::{ConfigError, GraphError};
3use callisto_model::CommandError;
4use miette::Diagnostic;
5
6#[derive(Debug, thiserror::Error, Diagnostic)]
7#[non_exhaustive]
8pub enum CliError {
9    #[error(transparent)]
10    #[diagnostic(transparent)]
11    Graph(#[from] GraphError),
12
13    #[error(transparent)]
14    #[diagnostic(transparent)]
15    Locate(#[from] LocateError),
16
17    #[error(transparent)]
18    #[diagnostic(transparent)]
19    Config(#[from] ConfigError),
20
21    #[error(transparent)]
22    #[diagnostic(transparent)]
23    Command(#[from] CommandError),
24
25    #[error(transparent)]
26    #[diagnostic(transparent)]
27    ChangesetParse(#[from] callisto_format::ParseError),
28
29    #[error(transparent)]
30    #[diagnostic(transparent)]
31    ChangesetWrite(#[from] callisto_format::WriteError),
32
33    #[error(transparent)]
34    #[diagnostic(transparent)]
35    Manifest(#[from] callisto_model::ManifestError),
36
37    #[error(transparent)]
38    #[diagnostic(transparent)]
39    Vcs(#[from] callisto_vcs::VcsError),
40
41    #[error(transparent)]
42    #[diagnostic(code(callisto::pre_json_error))]
43    PreJson(#[from] callisto_format::PreJsonError),
44
45    #[error(transparent)]
46    #[diagnostic(code(callisto::io_error))]
47    Io(#[from] std::io::Error),
48
49    #[error(
50        "refusing to prompt interactively: stdin is not a terminal and no non-interactive flags were given"
51    )]
52    #[diagnostic(
53        code(callisto::not_a_tty),
54        help("specify package names explicitly via `callisto add --package <name>:<severity>` in CI environments")
55    )]
56    NotATty,
57
58    #[error("{0}")]
59    #[diagnostic(code(callisto::error))]
60    Other(String),
61}