Add fs::error::unknown, don't throw

This commit is contained in:
Nekotekina 2020-03-07 11:18:23 +03:00
parent 66b0b78055
commit 8461a5cbe2
2 changed files with 4 additions and 3 deletions

View File

@ -129,8 +129,7 @@ static fs::error to_error(DWORD e)
case ERROR_DIR_NOT_EMPTY: return fs::error::notempty;
case ERROR_NOT_READY: return fs::error::noent;
case ERROR_FILENAME_EXCED_RANGE: return fs::error::toolong;
//case ERROR_INVALID_PARAMETER: return fs::error::inval;
default: fmt::throw_exception("Unknown Win32 error: %u.", e);
default: return fs::error::unknown;
}
}
@ -171,7 +170,7 @@ static fs::error to_error(int e)
case ENOTEMPTY: return fs::error::notempty;
case EROFS: return fs::error::readonly;
case EISDIR: return fs::error::isdir;
default: fmt::throw_exception("Unknown system error: %d.", e);
default: return fs::error::unknown;
}
}
@ -1823,6 +1822,7 @@ void fmt_class_string<fs::error>::format(std::string& out, u64 arg)
case fs::error::readonly: return "Read only";
case fs::error::isdir: return "Is a directory";
case fs::error::toolong: return "Path too long";
case fs::error::unknown: return "Unknown system error";
}
return unknown;

View File

@ -516,6 +516,7 @@ namespace fs
readonly,
isdir,
toolong,
unknown
};
// Error code returned