Skip to content

Commit

Permalink
Gracefully handle failure to load package cache files.
Browse files Browse the repository at this point in the history
  • Loading branch information
s-ludwig committed Apr 2, 2015
1 parent fba37c4 commit 16b555e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion source/dub/packagesupplier.d
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,12 @@ class RegistryPackageSupplier : PackageSupplier {

case CacheOp.load:
if (!path.existsFile()) return;
deserializeJson(m_metadataCache, jsonFromFile(path));
try deserializeJson(m_metadataCache, jsonFromFile(path));
catch (Exception e) {
import std.encoding;
logWarn("Error loading package cache file %s: %s", path.toNativeString(), e.msg);
logDebug("Full error: %s", e.toString().sanitize());
}
break;

case CacheOp.clean:
Expand Down

0 comments on commit 16b555e

Please sign in to comment.