3 ms·
> If my application spits out "IO error: nonexistent file", I need to know which line it came from to know which file it's talking about. Last time I needed th
by cesarb 7y ago
> If my application spits out "IO error: nonexistent file", I need to know which line it came from to know which file it's talking about.
Last time I needed this, I created a simple ErrorWithPath<E> wrapper around Error which also stores the path as a String, and a helper function which calls a closure and wraps any errors on its result with that wrapper. (If you want to take a look, it's at https://github.com/cesarb/filestatrec/blob/master/src/error.rs https://github.com/cesarb/filestatrec/blob/master/src/error....)