mit_commit_message_lints/relates/cmd/
errors.rs

1use std::{num, time};
2
3use miette::Diagnostic;
4use thiserror::Error;
5
6use crate::external;
7
8/// Overall errors for this binary
9#[derive(Error, Debug, Diagnostic)]
10pub enum Error {
11    /// A failure from libgit2
12    #[error("failed to interact with the git config: {0}")]
13    #[diagnostic(transparent)]
14    GitIo(external::Error),
15
16    /// Out of range integral type conversion attempted
17    #[error("failed converted epoch int between types: {0}")]
18    #[diagnostic(
19        url(docsrs),
20        code(mit_commit_message_lints::relates::vcs::error::epoch_convert)
21    )]
22    EpochConvert(num::TryFromIntError),
23
24    /// An error reading the system time
25    #[error("failed to get system time: {0}")]
26    #[diagnostic(
27        url(docsrs),
28        code(mit_commit_message_lints::relates::vcs::error::system_time)
29    )]
30    SystemTime(time::SystemTimeError),
31}