mirror of https://github.com/djcb/mu.git
mu-maildir: improve error handling / reporting
This commit is contained in:
parent
06be7a24e7
commit
0055b40a8d
|
@ -296,7 +296,7 @@ msg_move_g_file(const std::string& src, const std::string& dst)
|
||||||
if (res)
|
if (res)
|
||||||
return Ok();
|
return Ok();
|
||||||
else
|
else
|
||||||
return Err(Error{Error::Code::File, &err,
|
return Err(Error{Error::Code::File, &err/*consumed*/,
|
||||||
"error moving %s -> %s",
|
"error moving %s -> %s",
|
||||||
src.c_str(), dst.c_str()});
|
src.c_str(), dst.c_str()});
|
||||||
}
|
}
|
||||||
|
@ -313,15 +313,15 @@ msg_move(const std::string& src, const std::string& dst, bool force_gio)
|
||||||
return msg_move_verify(src, dst);
|
return msg_move_verify(src, dst);
|
||||||
|
|
||||||
if (errno != EXDEV) /* some unrecoverable error occurred */
|
if (errno != EXDEV) /* some unrecoverable error occurred */
|
||||||
return Err(Error{Error::Code::File, "error moving %s -> %s",
|
return Err(Error{Error::Code::File, "error moving %s -> %s: %s",
|
||||||
src.c_str(), dst.c_str()});
|
src.c_str(), dst.c_str(), strerror(errno)});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the EXDEV / force-gio case -- source and target live on different
|
/* the EXDEV / force-gio case -- source and target live on different
|
||||||
* filesystems */
|
* filesystems */
|
||||||
if (!msg_move_g_file(src, dst))
|
auto res = msg_move_g_file(src, dst);
|
||||||
return Err(Error{Error::Code::File, "error moving %s -> %s",
|
if (!res)
|
||||||
src.c_str(), dst.c_str()});
|
return res;
|
||||||
else
|
else
|
||||||
return msg_move_verify(src, dst);
|
return msg_move_verify(src, dst);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue