Skip to content

Commit 6ceb348

Browse files
committed
Adjust code again to avoid weird throw mishandling
1 parent 26ef23c commit 6ceb348

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

osu.Game/Beatmaps/LocalCachedBeatmapMetadataSource.cs

+8-6
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,14 @@ public bool TryLookup(BeatmapInfo beatmapInfo, [NotNullWhen(true)] out OnlineBea
113113
return queryCacheVersion2(db, beatmapInfo, out onlineMetadata);
114114
}
115115
}
116+
117+
onlineMetadata = null;
118+
return false;
116119
}
117120
catch (SqliteException sqliteException)
118121
{
122+
onlineMetadata = null;
123+
119124
// There have been cases where the user's local database is corrupt.
120125
// Let's attempt to identify these cases and re-initialise the local cache.
121126
switch (sqliteException.SqliteErrorCode)
@@ -124,25 +129,22 @@ public bool TryLookup(BeatmapInfo beatmapInfo, [NotNullWhen(true)] out OnlineBea
124129
case 11: // SQLITE_CORRUPT
125130
// only attempt purge & re-download if there is no other refetch in progress
126131
if (cacheDownloadRequest != null)
127-
throw;
132+
return false;
128133

129134
tryPurgeCache();
130135
prepareLocalCache();
131-
onlineMetadata = null;
132136
return false;
133137
}
134138

135-
throw;
139+
logForModel(beatmapInfo.BeatmapSet, $@"Cached local retrieval for {beatmapInfo} failed with unhandled sqlite error {sqliteException}.");
140+
return false;
136141
}
137142
catch (Exception ex)
138143
{
139144
logForModel(beatmapInfo.BeatmapSet, $@"Cached local retrieval for {beatmapInfo} failed with {ex}.");
140145
onlineMetadata = null;
141146
return false;
142147
}
143-
144-
onlineMetadata = null;
145-
return false;
146148
}
147149

148150
private void tryPurgeCache()

0 commit comments

Comments
 (0)