

Since context is kind of on topic, what should one write there? Are there any principles for writing good context messages?
fn beebboop() {
foo();
bar().context("frobnicating");
baz();
}
Instead of “frobnicating” in this rough example, I could also write that we intend to “baz” afterwards or that we are “currently beebbooping” or “bar failed” or I could even mention “foo” or …
From my (rather limited) experience, it seems most useful to describe what beebboop is about to do. Sometimes that is weird though, because then the context for foo, bar, and baz calls would be essentially the same.














I just optimized the context messages and I’m now happy with:
The “0” context is especially important because it tells you which file is read-only. Here is the code for that:
I don’t think something like “failed to clear dependencies using sqlite db ‘{}’” would be helpful. Something like “failed to” or “error when” does not really add any information. Just describe what is happening. Also, the “clear dependencies” would be redundant because that function can handle that part itself (see msg 1).