Skip to content

Commit

Permalink
Even more informative error message
Browse files Browse the repository at this point in the history
  • Loading branch information
veloman-yunkan committed Feb 13, 2022
1 parent 71d25f9 commit 3776b66
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/fs_unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <unistd.h>
#include <dirent.h>
#include <errno.h>
#include <string.h>

namespace zim
{
Expand Down Expand Up @@ -81,7 +82,8 @@ FD FS::openFile(path_t filepath)
{
int fd = open(filepath.c_str(), O_RDONLY);
if (fd == -1) {
throw std::runtime_error("Error opening file: " + filepath);
const std::string errorStr = strerror(errno);
throw std::runtime_error("Error opening file: " + filepath + ": " + errorStr);
}
return FD(fd);
}
Expand Down

0 comments on commit 3776b66

Please sign in to comment.