aboutsummaryrefslogtreecommitdiff
path: root/federationapi/routing/state.go
diff options
context:
space:
mode:
Diffstat (limited to 'federationapi/routing/state.go')
-rw-r--r--federationapi/routing/state.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/federationapi/routing/state.go b/federationapi/routing/state.go
index 5377eb88..1d08d0a8 100644
--- a/federationapi/routing/state.go
+++ b/federationapi/routing/state.go
@@ -135,23 +135,24 @@ func getState(
return nil, nil, &resErr
}
- if !response.StateKnown {
+ switch {
+ case !response.RoomExists:
+ return nil, nil, &util.JSONResponse{
+ Code: http.StatusNotFound,
+ JSON: jsonerror.NotFound("Room not found"),
+ }
+ case !response.StateKnown:
return nil, nil, &util.JSONResponse{
Code: http.StatusNotFound,
JSON: jsonerror.NotFound("State not known"),
}
- }
- if response.IsRejected {
+ case response.IsRejected:
return nil, nil, &util.JSONResponse{
Code: http.StatusNotFound,
JSON: jsonerror.NotFound("Event not found"),
}
}
- if !response.RoomExists {
- return nil, nil, &util.JSONResponse{Code: http.StatusNotFound, JSON: nil}
- }
-
return response.StateEvents, response.AuthChainEvents, nil
}