1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use thiserror::Error;
#[derive(Debug, Error)]
pub enum Error {
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
#[error("expected path to be a directory: {0}")]
ExpectedDir(String),
#[error("unexpected release directory name prefix: \"{0}\"")]
UnexpectedReleaseDirPrefix(String),
#[error("cannot obtain (or invalid) last component of path: \"{0}\"")]
CannotObtainName(String),
#[error("cannot extract version")]
CannotExtractVersion(String),
#[error("directory already exists: {0}")]
DirExists(String),
#[error("file already exists: {0}")]
FileExists(String),
#[error("invalid semantic version")]
InvalidSemanticVersion(#[from] semver::Error),
#[error("expected entry ID to start with a number, but got: \"{0}\"")]
InvalidEntryId(String),
#[error("failed to parse entry ID as a number")]
InvalidEntryNumber(#[from] std::num::ParseIntError),
}