mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 07:28:27 +00:00
Return clearer error when no state NID exists for an event (#2555)
This commit is contained in:
parent
5087b36af0
commit
d4341a2d97
1 changed files with 6 additions and 0 deletions
|
@ -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 a new issue