From 54941e028f024d527eef2142124fb7d6c9dabb98 Mon Sep 17 00:00:00 2001 From: Justin Leniger Date: Tue, 13 Jun 2023 18:13:01 -0600 Subject: [PATCH 1/2] Fix unhandled exception when Windows API fails to delete cached countries DB. --- scwx-qt/source/scwx/qt/config/county_database.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scwx-qt/source/scwx/qt/config/county_database.cpp b/scwx-qt/source/scwx/qt/config/county_database.cpp index c6fdca8a..4aa05097 100644 --- a/scwx-qt/source/scwx/qt/config/county_database.cpp +++ b/scwx-qt/source/scwx/qt/config/county_database.cpp @@ -129,7 +129,14 @@ void Initialize() sqlite3_close(db); // Remove temporary file - std::filesystem::remove(countyDatabaseCache); + std::error_code err; + + if (!std::filesystem::remove(countyDatabaseCache, err)) { + logger_->error( + "Unable to remove cached copy of database, error code: {} error category: {}", + err.value(), + err.category().name()); + } initialized_ = true; } From 721a5839bbfb313390cd2ba692f916621e5acc76 Mon Sep 17 00:00:00 2001 From: Justin Leniger Date: Tue, 13 Jun 2023 18:19:18 -0600 Subject: [PATCH 2/2] Lower log level to warn --- scwx-qt/source/scwx/qt/config/county_database.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scwx-qt/source/scwx/qt/config/county_database.cpp b/scwx-qt/source/scwx/qt/config/county_database.cpp index 4aa05097..a0d7b51c 100644 --- a/scwx-qt/source/scwx/qt/config/county_database.cpp +++ b/scwx-qt/source/scwx/qt/config/county_database.cpp @@ -132,7 +132,7 @@ void Initialize() std::error_code err; if (!std::filesystem::remove(countyDatabaseCache, err)) { - logger_->error( + logger_->warn( "Unable to remove cached copy of database, error code: {} error category: {}", err.value(), err.category().name());