Tired of bad I/O error messages that don't include file paths?
Check out fs-err, a crate I've been working on with Andrew Hickman: https://github.com/andrewhickman/fs-err …
It's mostly a drop-in replacement for std::fs and uses std::io::Error -- compatible with the Read/Write traits!
#rustlang
-
-
Replying to @LPGhatguy @fasterthanlime
Great work! Why didn't they fix that yet tho. The errors are terible and terribly subpar to what we are used to from Rust :)
1 reply 0 retweets 0 likes -
Replying to @yatekii @LPGhatguy
It's mostly a zero-allocations / lifetime issue
2 replies 0 retweets 4 likes -
Replying to @fasterthanlime @yatekii
If io::Error could borrow and then optionally become owned, then it could track a passed-in &Path, but that would obviously not be ideal. I dunno, I'm starting to be in the camp that if you're doing a whole I/O operation then you can probably handle an allocation :D
1 reply 0 retweets 0 likes -
I definitely wouldn't assume this but you're not std do you don't need to be usable in every situation.
1 reply 0 retweets 1 like -
I think you're right, but std having bad I/O error messages by default has been a drain on the ecosystem. We have to rewrite methods like remove_dir_all to get any actionable diagnostics! I imagine I'm not alone in how much time I've wasted trying to debug io::Error errors.
1 reply 0 retweets 3 likes -
Yea this is very true, the approach I've taken to this is to rely on tracing to store context like paths and capture Spantraces in my errors which hopefully gives the story of what was happening when the error happened, but if you forget to add the spans you're still fked
1 reply 1 retweet 0 likes -
I hold both these views: - rust's commitment to std being very strict, high bar to entry, minimal assumptions, as versatile as possible is a good thing - most Rust desktop applications need an abstraction that's slightly higher and that's ok
2 replies 0 retweets 7 likes -
Wtb convenient-std
1 reply 0 retweets 2 likes -
I think async-std has pathful errors? /cc
@killercup@yoshuawuyts1 reply 0 retweets 4 likes
We do! Indeed thanks to @killercup who added it for several APIs.
-
-
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.