Skip to main content

fluidattacks_core_git/
errors.rs

1use std::io;
2use std::process::ExitStatus;
3use std::time::Duration;
4
5#[derive(Debug, thiserror::Error)]
6pub enum GitCallError {
7    #[error("git {command} could not start: {source}")]
8    NotStarted {
9        command: &'static str,
10        source: io::Error,
11    },
12    #[error("git {command} did not finish within {after:?}")]
13    TimedOut {
14        command: &'static str,
15        after: Duration,
16    },
17    /// git ran and refused, as it does for a missing repository or revision.
18    #[error("git {command} exited with {status}: {stderr}")]
19    Refused {
20        command: &'static str,
21        status: ExitStatus,
22        stderr: String,
23    },
24    #[error("git {command} printed something unreadable: {reason}")]
25    Malformed {
26        command: &'static str,
27        reason: String,
28    },
29}