-
Notifications
You must be signed in to change notification settings - Fork 4
/
error.rs
87 lines (85 loc) · 3.68 KB
/
error.rs
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//! Errors that can be produced by unclog.
use std::path::PathBuf;
use thiserror::Error;
/// All error variants that can be produced by unclog.
#[derive(Debug, Error)]
pub enum Error {
#[error("I/O error relating to {0}: {1}")]
Io(PathBuf, std::io::Error),
#[error("failed to execute subprocess {0}: {1}")]
Subprocess(String, 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),
#[error("no unreleased entries yet")]
NoUnreleasedEntries,
#[error("non-UTF8 characters in string")]
NonUtf8String(#[from] std::string::FromUtf8Error),
#[error("non-zero process exit code when executing {0}: {1}")]
NonZeroExitCode(String, i32),
#[error("failed to parse JSON: {0}")]
JsonParsingFailed(#[from] serde_json::Error),
#[error("no such cargo package: {0}")]
NoSuchCargoPackage(String),
#[error("failed to get relative package path: {0}")]
StripPrefixError(#[from] std::path::StripPrefixError),
#[error("unrecognized project type: {0}")]
UnrecognizedProjectType(String),
#[error("cannot autodetect project type in path: {0}")]
CannotAutodetectProjectType(PathBuf),
#[error("invalid bullet style - can only be \"*\" or \"-\"")]
InvalidBulletStyle,
#[error("failed to parse TOML file \"{0}\": {1}")]
TomlParse(String, toml::de::Error),
#[error("failed to serialize TOML: {0}")]
TomlSerialize(toml::ser::Error),
#[error("failed to parse URL: {0}")]
FailedToParseUrl(#[from] url::ParseError),
#[error("missing issue number (--issue-no) or pull request (--pull-request)")]
MissingIssueNoOrPullRequest,
#[error("please specify either an issue number (--issue-no) or a pull request (--pull-request), but not both")]
EitherIssueNoOrPullRequest,
#[error("the URL is missing its host: {0}")]
UrlMissingHost(String),
#[error("not a GitHub project: {0}")]
NotGitHubProject(String),
#[error("GitHub project is missing its path: {0}")]
GitHubProjectMissingPath(String),
#[error("GitHub project URLs must include both the org/user ID and project ID: {0}")]
InvalidGitHubProjectPath(String),
#[error("configuration is missing a project URL (needed for automatic entry generation)")]
MissingProjectUrl,
#[error("error loading Handlebars template: {0}")]
HandlebarsTemplateLoad(String),
#[error("error rendering Handlebars template: {0}")]
HandlebarsTemplateRender(String),
#[error("git error: {0}")]
Git(#[from] git2::Error),
#[error("configuration file already exists: {0}")]
ConfigurationFileAlreadyExists(String),
#[error("no parent folder for path: {0}")]
NoParentFolder(String),
#[error("invalid URL in Git repository for remote \"{0}\": {1}")]
InvalidGitRemoteUrl(String, String),
#[error("invalid URL: {0}")]
InvalidUrl(String),
#[error("component \"{0}\" is not defined in changelog config.toml file")]
ComponentNotDefined(String),
#[error("CLI error: {0}")]
CommandLine(String),
}