dtolnay / dtolnay/anyhow

serde_json::Error locations are omitted from the backtrace

Open
#400 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
6.7k
Forks
224
PR merge metrics
No merged PRs in 30d

Description

Hey.

I'm returning an error [of the following structure](https://github.com/teloxide/teloxide/blob/94db1757dc96116f4756a586fcbce3ac5ebd0c59/crates/teloxide-core/src/errors.rs#L38) from my method with the return type `anyhow::Result<()>`. Strangely, when I try to log the backtrace, **I can't see the lines related to the `serde_json::Error` that is the source:**

```rust
// my logging function
pub(crate) fn log_endpoint_err(err: &anyhow::Error) {
log::error!("{err}, {}", err.backtrace())
}
```

Can some frames be omitted from the backtrace under any circumstances?
Can [a "gap"](https://github.com/serde-rs/json/blob/master/src/error.rs#L394) in the `source()` chain be a reason for this? (My error is "EOF when decoding a value", not an `Io` category of `serde_json:Error`'s

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.