I have functions like this:
fn run() -> Result<(), Box<Error>> {
let file = File::create("post.txt")?;
...
Ok(())
}
But the error messages from Display
-ing the file open / write / etc. errors are terribly vague. How would I make the errors more detailed without complicating the code with error handling statements everywhere?
Right now the errors resemble Permission denied (os error 13)
, but I want them to look like Could not create file 'post.txt' (permission denied).
or something at least as informative and readable.