Skip to content

Commit 5d885bb

Browse files
committed
chore: update warning logs when a cache config is invalid or fails to be parsed as JSON and delete that cache key
1 parent 295d84f commit 5d885bb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

DevCycle/Models/Cache.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ class CacheService: CacheServiceProtocol {
7575
let dictionary = try? JSONSerialization.jsonObject(
7676
with: data, options: .fragmentsAllowed) as? [String: Any]
7777
else {
78-
Log.debug("Skipping cached config: no config found")
78+
Log.debug("Skipping cached config: no config found or invalid JSON detected")
79+
cleanupCacheEntry(key: key)
7980
return nil
8081
}
8182

8283
do {
83-
let config = try UserConfig(from: dictionary)
84-
return config
84+
return try UserConfig(from: dictionary)
8585
} catch {
8686
Log.warn("Skipping cached config: error parsing cached config. Deleting cached config")
8787
cleanupCacheEntry(key: key)

0 commit comments

Comments
 (0)