From 043a863cef0cecd85d81704a2cfa89bc8964d5c0 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Mon, 14 Apr 2025 01:49:47 -0400 Subject: [SharedCache] Bubble up errors in `CacheEntry::FromFile` to the user Prior to this we would not have meaningful errors shown to the user when we fail to construct a CacheEntry from a file. Apart of trying to make the opening of shared caches clearer. --- view/sharedcache/core/SharedCacheBuilder.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'view/sharedcache/core/SharedCacheBuilder.cpp') diff --git a/view/sharedcache/core/SharedCacheBuilder.cpp b/view/sharedcache/core/SharedCacheBuilder.cpp index ac2990fa..3b370662 100644 --- a/view/sharedcache/core/SharedCacheBuilder.cpp +++ b/view/sharedcache/core/SharedCacheBuilder.cpp @@ -37,19 +37,17 @@ bool SharedCacheBuilder::AddFile( try { - if (auto entry = CacheEntry::FromFile(filePath, fileName, cacheType)) - { - m_cache.AddEntry(std::move(*entry)); - return true; - } + auto entry = CacheEntry::FromFile(filePath, fileName, cacheType); + m_cache.AddEntry(std::move(entry)); } catch (const std::exception& e) { // Just return false so the view init can continue. - m_logger->LogErrorF("Failed to add file {}... {}", fileName, e.what()); + m_logger->LogErrorF("Failed to add file '{}': {}", fileName, e.what()); + return false; } - return false; + return true; } size_t SharedCacheBuilder::AddDirectory(const std::string& directoryPath) -- cgit v1.3.1