| 1 | |
| 2 | |
| 3 | #[derive(Debug, thiserror::Error)] |
| 4 | pub enum Error { |
| 5 | #[error("io error: {0}")] |
| 6 | Io(#[from] std::io::Error), |
| 7 | #[error("git binary unusable: {0}")] |
| 8 | Unavailable(String), |
| 9 | #[error("git {found} is older than required {required}")] |
| 10 | TooOld { found: String, required: String }, |
| 11 | #[error("invalid revision or path: {0}")] |
| 12 | InvalidInput(String), |
| 13 | #[error("git command failed: {0}")] |
| 14 | Failed(String), |
| 15 | |
| 16 | #[error("ref moved since it was read: {0}")] |
| 17 | RefMoved(String), |
| 18 | } |
| 19 | |
| 20 | pub type Result<T> = std::result::Result<T, Error>; |
| 21 | |
| 22 | impl From<Error> for forge_core::Error { |
| 23 | fn from(e: Error) -> Self { |
| 24 | forge_core::Error::Git(e.to_string()) |
| 25 | } |
| 26 | } |