diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-02-21 16:22:29 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-21 16:22:29 +0000 |
commit | aa6bbf484a7963a754d47ba04869c06b72d4ee49 (patch) | |
tree | 1e558f5892f6c244815f725862d21ae39a4ddf2b /roomserver/internal/perform | |
parent | cf525d1f619cc65df244c20ec0f220ace22ae2bd (diff) |
Return `ErrRoomNoExists` if insufficient state is available for a `buildEvent` to succeed when joining a room (#2210)
This may help cases like #2206, since it should prompt us to try a federated join again instead.
Diffstat (limited to 'roomserver/internal/perform')
-rw-r--r-- | roomserver/internal/perform/perform_join.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/roomserver/internal/perform/perform_join.go b/roomserver/internal/perform/perform_join.go index 9d2a66d4..a40f66d2 100644 --- a/roomserver/internal/perform/perform_join.go +++ b/roomserver/internal/perform/perform_join.go @@ -29,6 +29,7 @@ import ( "github.com/matrix-org/dendrite/roomserver/internal/input" "github.com/matrix-org/dendrite/roomserver/internal/query" "github.com/matrix-org/dendrite/roomserver/storage" + "github.com/matrix-org/dendrite/roomserver/types" "github.com/matrix-org/dendrite/setup/config" "github.com/matrix-org/gomatrixserverlib" "github.com/sirupsen/logrus" @@ -367,7 +368,15 @@ func buildEvent( StateToFetch: eventsNeeded.Tuples(), }, &queryRes) if err != nil { - return nil, nil, fmt.Errorf("QueryLatestEventsAndState: %w", err) + switch err.(type) { + case types.MissingStateError: + // We know something about the room but the state seems to be + // insufficient to actually build a new event, so in effect we + // had might as well treat the room as if it doesn't exist. + return nil, nil, eventutil.ErrRoomNoExists + default: + return nil, nil, fmt.Errorf("QueryLatestEventsAndState: %w", err) + } } ev, err := eventutil.BuildEvent(ctx, builder, cfg, time.Now(), &eventsNeeded, &queryRes) |