Skip to content

Commit 6f3c8a5

Browse files
committed
improved error messages
1 parent d9d8f0a commit 6f3c8a5

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

tmc-langs-cli/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ fn write_result_to_file_as_json<T: Serialize>(result: &T, output_path: &Path) ->
713713
)
714714
})?;
715715

716-
serde_json::to_writer_pretty(output_file, result).with_context(|| {
716+
serde_json::to_writer(output_file, result).with_context(|| {
717717
format!(
718718
"Failed to write result as JSON to {}",
719719
output_path.display()
@@ -781,7 +781,7 @@ fn run_checkstyle(exercise_path: &Path, output_path: &Path, locale: Language) ->
781781
output_path.display()
782782
)
783783
})?;
784-
serde_json::to_writer_pretty(output_file, &check_result).with_context(|| {
784+
serde_json::to_writer(output_file, &check_result).with_context(|| {
785785
format!(
786786
"Failed to write code style check results as JSON to {}",
787787
output_path.display()

tmc-langs-framework/src/error.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ use thiserror::Error;
66
#[derive(Error, Debug)]
77
pub enum Error {
88
// IO
9-
#[error("Failed to open file at {0}: {1}")]
9+
#[error("Failed to open file at {0}")]
1010
OpenFile(PathBuf, #[source] std::io::Error),
11-
#[error("Failed to create file at {0}: {1}")]
11+
#[error("Failed to create file at {0}")]
1212
CreateFile(PathBuf, #[source] std::io::Error),
13-
#[error("Failed to create dir at {0}: {1}")]
13+
#[error("Failed to create dir(s) at {0}")]
1414
CreateDir(PathBuf, #[source] std::io::Error),
15-
#[error("Failed to rename {0} to {1}: {2}")]
15+
#[error("Failed to rename {0} to {1}")]
1616
Rename(PathBuf, PathBuf, #[source] std::io::Error),
17-
#[error("Failed to write to {0}: {1}")]
17+
#[error("Failed to write to {0}")]
1818
Write(PathBuf, #[source] std::io::Error),
1919

2020
#[error("Path {0} contained invalid UTF8")]
@@ -24,7 +24,7 @@ pub enum Error {
2424
PluginNotFound(PathBuf),
2525
#[error("No project directory found in archive during unzip")]
2626
NoProjectDirInZip,
27-
#[error("Running command '{0}' failed: {1}")]
27+
#[error("Running command '{0}' failed")]
2828
CommandFailed(&'static str, #[source] std::io::Error),
2929

3030
#[error("Failed to spawn command: {0}")]

0 commit comments

Comments
 (0)