Skip to content

Commit

Permalink
fix: Remove string cleaning in error report (#303)
Browse files Browse the repository at this point in the history
* Remove string splitting in error report

* Add module comment
  • Loading branch information
Techassi authored Jun 21, 2024
1 parent 4ccd0a5 commit a492033
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions rust/stackablectl/src/output/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
//! This module contains helper structs and functions to render the CLI output
//! based on templates. These templates allow dynamic composition of the output.
//! The output offers sections for pre, post and command hints, as well as
//! success and error output. The [`ErrorReport`] serves as an alternative to
//! snafu's [`Report`](snafu::Report).
use std::{
fmt::Write,
ops::{Deref, DerefMut},
Expand Down Expand Up @@ -59,16 +65,7 @@ where
let mut index = 1;

while let Some(source) = error.source() {
let source_string = source.to_string();

let cleaned = if let Some((cleaned, _)) = source_string.split_once(':') {
cleaned
} else {
&source_string
};

writeln!(report, " {}: {}", index, cleaned)?;

writeln!(report, " {}: {}", index, source)?;
error = source;
index += 1;
}
Expand Down

0 comments on commit a492033

Please sign in to comment.