human_errors/from/
std_io.rs1use crate::{system_with_internal, user_with_internal, Error};
2use std::convert;
3use std::io;
4
5impl convert::From<io::Error> for Error {
6 fn from(err: io::Error) -> Self {
7 match err.kind() {
8 io::ErrorKind::NotFound => user_with_internal(
9 "Could not find the requested file.",
10 "Check that the file path you provided is correct and try again.",
11 err),
12 _ => system_with_internal(
13 "An internal error occurred which we could not recover from.",
14 "Please read the internal error below and decide if there is something you can do to fix the problem, or report it to us on GitHub.",
15 err)
16 }
17 }
18}