debian_packaging/
error.rs1use {simple_file_manifest::FileManifestError, thiserror::Error};
8
9#[derive(Debug, Error)]
11pub enum DebianError {
12 #[error("file manifest error: {0}")]
13 FileManifestError(#[from] FileManifestError),
14
15 #[error("URL error: {0:?}")]
16 Url(#[from] url::ParseError),
17
18 #[error("PGP error: {0:?}")]
19 Pgp(#[from] pgp::errors::Error),
20
21 #[error("date parsing error: {0:?}")]
22 DateParse(#[from] mailparse::MailParseError),
23
24 #[cfg(feature = "http")]
25 #[error("HTTP error: {0:?}")]
26 Reqwest(#[from] reqwest::Error),
27
28 #[error("I/O error: {0:?}")]
29 Io(#[from] std::io::Error),
30
31 #[error("integer parsing error: {0:?}")]
32 ParseInt(#[from] std::num::ParseIntError),
33
34 #[error("invalid hex string (`{0}`) when parsing content digest: {0:?}")]
35 ContentDigestBadHex(String, hex::FromHexError),
36
37 #[error("control file parse error: {0}")]
38 ControlParseError(String),
39
40 #[error("Control file lacks a paragraph")]
41 ControlFileNoParagraph,
42
43 #[error("Control file not found")]
44 ControlFileNotFound,
45
46 #[error("cannot convert to simple field value since value contains line breaks")]
47 ControlSimpleValueNoMultiline,
48
49 #[error("required control paragraph field not found: {0}")]
50 ControlRequiredFieldMissing(String),
51
52 #[error("control field {0} can not be parsed as an integer: {0:?}")]
53 ControlFieldIntParse(String, std::num::ParseIntError),
54
55 #[error("failed to parse control field timestamp")]
56 ControlFieldTimestampParse,
57
58 #[error("missing field {0} in Package-List entry")]
59 ControlPackageListMissingField(&'static str),
60
61 #[error("expected 1 control paragraph in Debian source control file; got {0}")]
62 DebianSourceControlFileParagraphMismatch(usize),
63
64 #[error("unknown entry in binary package archive: {0}")]
65 DebUnknownBinaryPackageEntry(String),
66
67 #[error("unknown compression in deb archive file: {0}")]
68 DebUnknownCompression(String),
69
70 #[error("do not know how to construct repository reader from URL: {0}")]
71 RepositoryReaderUnrecognizedUrl(String),
72
73 #[error("do not know how to construct repository writer from URL: {0}")]
74 RepositoryWriterUnrecognizedUrl(String),
75
76 #[error("release file does not contain supported checksum flavor")]
77 RepositoryReadReleaseNoKnownChecksum,
78
79 #[error("could not find Contents indices entry in Release file")]
80 RepositoryReadContentsIndicesEntryNotFound,
81
82 #[error("could not find packages indices entry in Release file")]
83 RepositoryReadPackagesIndicesEntryNotFound,
84
85 #[error("could not find Sources indices entry in Release file")]
86 RepositoryReadSourcesIndicesEntryNotFound,
87
88 #[error("could not determine content digest of binary package")]
89 RepositoryReadCouldNotDeterminePackageDigest,
90
91 #[error("No packages indices for checksum {0}")]
92 RepositoryNoPackagesIndices(&'static str),
93
94 #[error("repository I/O error on path {0}: {1:?}")]
95 RepositoryIoPath(String, std::io::Error),
96
97 #[error("attempting to add package to undefined component: {0}")]
98 RepositoryBuildUnknownComponent(String),
99
100 #[error("attempting to add package to undefined architecture: {0}")]
101 RepositoryBuildUnknownArchitecture(String),
102
103 #[error("pool layout cannot be changed after content is indexed")]
104 RepositoryBuildPoolLayoutImmutable,
105
106 #[error(".deb not available: {0}")]
107 RepositoryBuildDebNotAvailable(&'static str),
108
109 #[error("expected 1 paragraph in control file; got {0}")]
110 ReleaseControlParagraphMismatch(usize),
111
112 #[error("digest missing from index entry")]
113 ReleaseMissingDigest,
114
115 #[error("size missing from index entry")]
116 ReleaseMissingSize,
117
118 #[error("path missing from index entry")]
119 ReleaseMissingPath,
120
121 #[error("index entry path unexpectedly has spaces: {0}")]
122 ReleasePathWithSpaces(String),
123
124 #[error("release indices file cannot be converted to the given type")]
125 ReleaseIndicesEntryWrongType,
126
127 #[error("No PGP signatures found")]
128 ReleaseNoSignatures,
129
130 #[error("No PGP signatures found from the specified key")]
131 ReleaseNoSignaturesByKey,
132
133 #[error("indices files not found in Release file")]
134 ReleaseNoIndicesFiles,
135
136 #[error("failed to parse dependency expression: {0}")]
137 DependencyParse(String),
138
139 #[error("unknown binary dependency field: {0}")]
140 UnknownBinaryDependencyField(String),
141
142 #[error("the epoch component has non-digit characters: {0}")]
143 EpochNonNumeric(String),
144
145 #[error("upstream_version component has illegal character: {0}")]
146 UpstreamVersionIllegalChar(String),
147
148 #[error("debian_revision component has illegal character: {0}")]
149 DebianRevisionIllegalChar(String),
150
151 #[error("unknown S3 region: {0}")]
152 S3BadRegion(String),
153
154 #[error("unknown verify behavior for null:// destination: {0}")]
155 SinkWriterVerifyBehaviorUnknown(String),
156
157 #[error("{0}")]
158 Other(String),
159}
160
161pub type Result<T> = std::result::Result<T, DebianError>;