From 54941e028f024d527eef2142124fb7d6c9dabb98 Mon Sep 17 00:00:00 2001 From: Justin Leniger Date: Tue, 13 Jun 2023 18:13:01 -0600 Subject: [PATCH] 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; }