Don't panic!

This commit is contained in:
Till Faelligen 2022-11-01 14:28:42 +01:00
parent ea2e5b132a
commit 487a336d1a
No known key found for this signature in database
GPG key ID: 3DF82D8AB9211D4E

View file

@ -171,7 +171,7 @@ func (v *StateResolution) LoadMembershipAtEvent(
if !ok {
// This should only get hit if the database is corrupt.
// It should be impossible for an event to reference a NID that doesn't exist
panic(fmt.Errorf("corrupt DB: Missing state snapshot numeric ID %d", stateBlockNIDList.StateSnapshotNID))
return nil, fmt.Errorf("corrupt DB: Missing state snapshot numeric ID %d", stateBlockNIDList.StateSnapshotNID)
}
for _, stateBlockNID := range stateBlockNIDs {
@ -179,7 +179,7 @@ func (v *StateResolution) LoadMembershipAtEvent(
if !ok {
// This should only get hit if the database is corrupt.
// It should be impossible for an event to reference a NID that doesn't exist
panic(fmt.Errorf("corrupt DB: Missing state block numeric ID %d", stateBlockNID))
return nil, fmt.Errorf("corrupt DB: Missing state block numeric ID %d", stateBlockNID)
}
evIDs := snapshotNIDMap[stateBlockNIDList.StateSnapshotNID]