initial working exn tracing

This commit is contained in:
2026-03-21 21:21:45 -04:00
parent ebe1836513
commit ddd6792205
4 changed files with 142 additions and 178 deletions

View File

@@ -2,11 +2,13 @@
Context aware errors.
Trying to get exn into structured output for tracing_subscriber.
https://github.com/fast/exn
https://fast.github.io/blog/stop-forwarding-errors-start-designing-them/
example output:
example default output:
```
the program died, at src/main.rs:35:34
@@ -15,3 +17,30 @@ the program died, at src/main.rs:35:34
|
|-> Permission denied (os error 13), at src/main.rs:79:43
```
example structured output
```json
{
"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"
}```