Fix Display impl for OllamaError: use write! instead of writeln!

The Display trait should not append trailing newlines, as callers
like println! and error chaining libraries (anyhow, eyre) add their
own. Also cleaned up the display strings to use readable names
instead of raw variant names.
This commit is contained in:
2026-01-30 19:29:29 +00:00
parent b70cc1a62d
commit d845103679

View File

@@ -16,9 +16,9 @@ impl Error for OllamaError {}
impl Display for OllamaError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
OllamaError::NetworkError(e) => writeln!(f, "Network error: {}", e),
OllamaError::ResponseParseError(e) => writeln!(f, "ResponseParseError error: {}", e),
OllamaError::LinesCoderError(e) => writeln!(f, "LinesCoderError error: {}", e),
OllamaError::NetworkError(e) => write!(f, "Network error: {}", e),
OllamaError::ResponseParseError(e) => write!(f, "Response parse error: {}", e),
OllamaError::LinesCoderError(e) => write!(f, "Lines codec error: {}", e),
}
}
}