diff options
| author | Mason Reed <mason@vector35.com> | 2025-04-14 01:49:47 -0400 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2025-04-14 03:20:51 -0400 |
| commit | 043a863cef0cecd85d81704a2cfa89bc8964d5c0 (patch) | |
| tree | ac15b1ab5880b238b62b5b1065ead81136051c0f /view/sharedcache/core/SharedCacheBuilder.cpp | |
| parent | 664bdcd29761844ba9558f9c5fd43949009424e3 (diff) | |
[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.
Diffstat (limited to 'view/sharedcache/core/SharedCacheBuilder.cpp')
| -rw-r--r-- | view/sharedcache/core/SharedCacheBuilder.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
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) |
