From: Ian Jackson Date: Wed, 11 May 2022 20:44:36 +0000 (+0100) Subject: MaterialsFormatVersionError: Improve messages X-Git-Tag: otter-1.1.0~234 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=962d5672f6dd1912b2e8db188b6137f02cecfda1;p=otter.git MaterialsFormatVersionError: Improve messages Well, I managed to produce these. But the output was a bit ugly. I think the stuff in Other about a "reasonable integer" is covered by the specific strings we pass in the integer conversions, and there's going to be a possibility of completely different kinds of problem: Use of a format default in a builtin shape library is going to become an error. And we don't want to add a variant for it - that's overkill. So we'll reuse Other, and this message is not right. Signed-off-by: Ian Jackson --- diff --git a/src/materials-format.rs b/src/materials-format.rs index 79a64f4d..645e1b49 100644 --- a/src/materials-format.rs +++ b/src/materials-format.rs @@ -62,7 +62,7 @@ impl Version { pub enum VersionError { #[error("{0}")] Unsupported(#[from] Unsupported), - #[error("bad format version (must be a reasonable integer): {0}")] + #[error("bad format version: {0}")] Other(&'static str), } diff --git a/src/shapelib.rs b/src/shapelib.rs index c723f8ca..83d39f92 100644 --- a/src/shapelib.rs +++ b/src/shapelib.rs @@ -134,7 +134,7 @@ pub enum LibraryLoadError { #[error("{0}")] BadSubstitution(#[from] SubstError), #[error("{0}")] UnsupportedColourSpec(#[from] UnsupportedColourSpec), #[error("bad item name (invalid characters) in {0:?}")] BadItemName(String), - #[error("{0:?}")] MaterialsFormatVersionError(#[from] MFVE), + #[error("{0}")] MaterialsFormatVersionError(#[from] MFVE), #[error("group {group}: {error}")] InGroup { group: String, error: Box },