From 8461a5cbe271b8751d599bf7161547cc882ece14 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Sat, 7 Mar 2020 11:18:23 +0300 Subject: [PATCH] Add fs::error::unknown, don't throw --- Utilities/File.cpp | 6 +++--- Utilities/File.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Utilities/File.cpp b/Utilities/File.cpp index c02e04f94e..8abd8fb54d 100644 --- a/Utilities/File.cpp +++ b/Utilities/File.cpp @@ -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::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; diff --git a/Utilities/File.h b/Utilities/File.h index 5bcf27b96d..36776b6b2e 100644 --- a/Utilities/File.h +++ b/Utilities/File.h @@ -516,6 +516,7 @@ namespace fs readonly, isdir, toolong, + unknown }; // Error code returned