More useful errors

This commit is contained in:
Neil Alexander 2022-08-16 17:23:33 +01:00
parent 1f15cfc6a3
commit 435616b48f
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -77,7 +77,7 @@ func (r *Queryer) QueryStateAfterEvents(
util.GetLogger(ctx).Errorf("QueryStateAfterEvents: MissingEventError: %s", err) util.GetLogger(ctx).Errorf("QueryStateAfterEvents: MissingEventError: %s", err)
return nil return nil
default: default:
return err return fmt.Errorf("r.DB.StateAtEventIDs: %w", err)
} }
} }
response.PrevEventsExist = true response.PrevEventsExist = true
@ -88,19 +88,22 @@ func (r *Queryer) QueryStateAfterEvents(
stateEntries, err = roomState.LoadCombinedStateAfterEvents( stateEntries, err = roomState.LoadCombinedStateAfterEvents(
ctx, prevStates, ctx, prevStates,
) )
if err != nil {
return fmt.Errorf("roomState.LoadCombinedStateAfterEvents: %w", err)
}
} else { } else {
// Look up the current state for the requested tuples. // Look up the current state for the requested tuples.
stateEntries, err = roomState.LoadStateAfterEventsForStringTuples( stateEntries, err = roomState.LoadStateAfterEventsForStringTuples(
ctx, prevStates, request.StateToFetch, ctx, prevStates, request.StateToFetch,
) )
}
if err != nil { if err != nil {
return err return fmt.Errorf("roomState.LoadStateAfterEventsForStringTuples: %w", err)
}
} }
stateEvents, err := helpers.LoadStateEvents(ctx, r.DB, stateEntries) stateEvents, err := helpers.LoadStateEvents(ctx, r.DB, stateEntries)
if err != nil { if err != nil {
return err return fmt.Errorf("helpers.LoadStateEvents: %w", err)
} }
if len(request.PrevEventIDs) > 1 && len(request.StateToFetch) == 0 { if len(request.PrevEventIDs) > 1 && len(request.StateToFetch) == 0 {