Skip to content

Commit 6659d40

Browse files
Improve error messages reported by the program
At the moment, we only print the first (outermost) error message when the program fails. This is not very helpful and results in messages like: ``` 2025-10-15T09:18:18.631953Z ERROR main mctrlrs: 103: Failed to load configuration file ``` as this tells what happened, but not why. With this change we will print the entire error stack preserving the context in full: ``` 2025-10-15T09:20:47.187633Z ERROR main mctrlrs: 101: Failed to load configuration file: Failed to parse configuration file: missing field `server_properties_path` at line 2 column 1 ```
1 parent d6b7afb commit 6659d40

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,13 @@ fn main() {
9898
let args = Args::parse();
9999

100100
if let Err(err) = real_main(args) {
101-
tracing::error!("{err}");
101+
tracing::error!(
102+
"{}",
103+
err.chain()
104+
.map(|err| err.to_string())
105+
.collect::<Vec<_>>()
106+
.join(": ")
107+
);
102108

103109
std::process::exit(1);
104110
}

0 commit comments

Comments
 (0)