mit_commit_message_lints/mit/cmd/
errors.rs

1//! Command errors
2use std::string::FromUtf8Error;
3
4use miette::Diagnostic;
5use thiserror::Error;
6
7/// Command error
8#[derive(Error, Debug, Diagnostic)]
9pub enum Error {
10    /// No authors provided to set
11    #[error("no authors provided to set")]
12    #[diagnostic(
13        url(docsrs),
14        code(mit_commit_message_lints::mit::cmd::errors::error::no_authors_to_set)
15    )]
16    NoAuthorsToSet,
17    /// Failed to convert author command output to unicode
18    #[error("failed to convert author command output to unicode")]
19    #[diagnostic(
20        url(docsrs),
21        code(git_mit::errors::git_mit_error::exec_utf8),
22        help("all characters must parse as utf8")
23    )]
24    ExecUtf8 {
25        /// The command we ran that failed
26        #[source_code]
27        command: String,
28        /// The error itself
29        #[source]
30        source: FromUtf8Error,
31    },
32    /// No mit initials provided
33    #[error("no mit initials provided")]
34    #[diagnostic(
35        url(docsrs),
36        code(git_mit::errors::git_mit_error::no_author_initials_provided)
37    )]
38    NoAuthorInitialsProvided,
39    /// No timeout set
40    #[error("no timeout set")]
41    #[diagnostic(url(docsrs), code(git_mit::errors::git_mit_error::no_timeout_set))]
42    NoTimeoutSet,
43    /// Expected a mit file path, didn't find one
44    #[error("expected a mit file path, didn't find one")]
45    #[diagnostic(url(docsrs), code(git_mit::errors::git_mit_error::author_file_not_set))]
46    AuthorFileNotSet,
47}