debian: type the errors of the format primitives
Give every parser of the shared format layer a proper error enum (thiserror): VersionParseError, ArchError, deps::ParseError (wrapping the version and arch failures as #[source] so the context chain survives), ControlParseError, ChecksumParseError, FilesParseError and TestsControlParseError, each carrying its structured pieces (the offending string, the stanza number, the field name) instead of a pre-formatted String. Display texts are byte-identical to the old format! strings, so user-facing output and the message-asserting tests are unchanged; the few tests asserting on error text now render the error first. Flow boundaries that still take String (build::env, quirks, test::expand) render with to_string() at the edge — typing those flows is a later step. ControlInfo's FromStr impl follows parse_content's error type.
This commit is contained in:
+1
-1
@@ -81,7 +81,7 @@ pub fn build_env(
|
||||
/// (`*_ARCH`, `*_OS`, `*_CPU`, `*_MULTIARCH`, `*_GNU_TYPE`, ...), exactly as
|
||||
/// `dpkg-buildpackage` does.
|
||||
pub fn arch_env(host_arch: Option<&str>) -> Result<BTreeMap<String, String>, String> {
|
||||
crate::debian::arch::arch_env(host_arch)
|
||||
crate::debian::arch::arch_env(host_arch).map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
/// Read the current vendor name from the active dpkg origins `default` file
|
||||
|
||||
Reference in New Issue
Block a user