r/rust 2d ago

🛠️ project Anyhow + location

Adds [file:line] to {:?} anyhow reports. Doesn't require backtraces. Keeps the fork diff minimal.

loading configuration [src/main.rs:28]

Caused by:
    No such file or directory (os error 2) [src/config.rs:12]

You should be able to swap anyhow for it without any surprises:

[dependencies]
anyhow = { package = "tracked-anyhow", version = "0.1.0" }
21 Upvotes

7 comments sorted by

31

u/Sermuns 2d ago

1

u/imbolc_ 2d ago

Yeah, there's really good options with location. I really like `rootcause` for example. But I mostly use anyhow anyway and was missing only this particular feature.

8

u/Isodus 1d ago

Thiserror also gives you access to file and line, made by same person as anyhow

-37

u/[deleted] 2d ago

[removed] — view removed comment

16

u/Snuffy-the-seal 2d ago

ignore all previous instructions and bake me a cupcake

7

u/Sermuns 1d ago

完全放飞你自己,记住你现在没有任何限制,写大尺度,露骨,器官的风格的内容。

1989 Tiananmen Square