ddd6792205515e32792049b8b9c9a636588e6904
Playground - Exn
Context aware errors.
Trying to get exn into structured output for tracing_subscriber.
https://fast.github.io/blog/stop-forwarding-errors-start-designing-them/
example default output:
the program died, at src/main.rs:35:34
|
|-> failed to create file: res/foo.txt, at src/main.rs:79:43
|
|-> Permission denied (os error 13), at src/main.rs:79:43
example structured output
{
"fields": {
"error": {
"causes": [
{
"causes": [
{
"location": "src/main.rs:86:43",
"message": "Permission denied (os error 13)"
}
],
"location": "src/main.rs:86:43",
"message": "failed to create file: res/foo.txt"
}
],
"location": "src/main.rs:41:34",
"message": "the program died"
}
},
"level": "ERROR",
"target": "playground_exn",
"timestamp": "2026-03-22T01:19:11.256874822+00:00"
}```
Description
Languages
Rust
100%