mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-25 21:21:35 +00:00
Return clearer error when no state NID exists for an event (#2555)
This commit is contained in:
parent
5087b36af0
commit
d4341a2d97
@ -263,6 +263,12 @@ func (d *Database) snapshotNIDFromEventID(
|
|||||||
ctx context.Context, txn *sql.Tx, eventID string,
|
ctx context.Context, txn *sql.Tx, eventID string,
|
||||||
) (types.StateSnapshotNID, error) {
|
) (types.StateSnapshotNID, error) {
|
||||||
_, stateNID, err := d.EventsTable.SelectEvent(ctx, txn, eventID)
|
_, stateNID, err := d.EventsTable.SelectEvent(ctx, txn, eventID)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
if stateNID == 0 {
|
||||||
|
return 0, sql.ErrNoRows // effectively there's no state entry
|
||||||
|
}
|
||||||
return stateNID, err
|
return stateNID, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user