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
@@ -266,7 +266,7 @@ fn apply_rules(
|
||||
}
|
||||
|
||||
for injected in &deps.inject {
|
||||
let parsed = Deps::parse(injected, opts)?;
|
||||
let parsed = Deps::parse(injected, opts).map_err(|e| e.to_string())?;
|
||||
clauses.extend(parsed.clauses().map(<[PkgRelation]>::to_vec));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user