mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-17 03:43:11 -06:00
Add some error wrapping for debug
This commit is contained in:
parent
bc45c3d1d2
commit
90062a3d0d
|
|
@ -323,14 +323,14 @@ func (r joinRoomReq) joinRoomUsingServer(roomID string, server gomatrixserverlib
|
||||||
respMakeJoin, err := r.federation.MakeJoin(r.req.Context(), server, roomID, r.userID, supportedVersions)
|
respMakeJoin, err := r.federation.MakeJoin(r.req.Context(), server, roomID, r.userID, supportedVersions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// TODO: Check if the user was not allowed to join the room.
|
// TODO: Check if the user was not allowed to join the room.
|
||||||
return nil, err
|
return nil, fmt.Errorf("r.federation.MakeJoin: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set all the fields to be what they should be, this should be a no-op
|
// Set all the fields to be what they should be, this should be a no-op
|
||||||
// but it's possible that the remote server returned us something "odd"
|
// but it's possible that the remote server returned us something "odd"
|
||||||
err = r.writeToBuilder(&respMakeJoin.JoinEvent, roomID)
|
err = r.writeToBuilder(&respMakeJoin.JoinEvent, roomID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, fmt.Errorf("r.writeToBuilder: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if respMakeJoin.RoomVersion == "" {
|
if respMakeJoin.RoomVersion == "" {
|
||||||
|
|
@ -350,18 +350,16 @@ func (r joinRoomReq) joinRoomUsingServer(roomID string, server gomatrixserverlib
|
||||||
r.cfg.Matrix.PrivateKey, respMakeJoin.RoomVersion,
|
r.cfg.Matrix.PrivateKey, respMakeJoin.RoomVersion,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
util.GetLogger(r.req.Context()).WithError(err).Error("respMakeJoin.JoinEvent.Build failed")
|
return nil, fmt.Errorf("respMakeJoin.JoinEvent.Build: %w", err)
|
||||||
res := jsonerror.InternalServerError()
|
|
||||||
return &res, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
respSendJoin, err := r.federation.SendJoin(r.req.Context(), server, event, respMakeJoin.RoomVersion)
|
respSendJoin, err := r.federation.SendJoin(r.req.Context(), server, event, respMakeJoin.RoomVersion)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, fmt.Errorf("r.federation.SendJoin: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = respSendJoin.Check(r.req.Context(), r.keyRing, event); err != nil {
|
if err = respSendJoin.Check(r.req.Context(), r.keyRing, event); err != nil {
|
||||||
return nil, err
|
return nil, fmt.Errorf("respSendJoin: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = r.producer.SendEventWithState(
|
if err = r.producer.SendEventWithState(
|
||||||
|
|
@ -369,9 +367,7 @@ func (r joinRoomReq) joinRoomUsingServer(roomID string, server gomatrixserverlib
|
||||||
gomatrixserverlib.RespState(respSendJoin.RespState),
|
gomatrixserverlib.RespState(respSendJoin.RespState),
|
||||||
event.Headered(respMakeJoin.RoomVersion),
|
event.Headered(respMakeJoin.RoomVersion),
|
||||||
); err != nil {
|
); err != nil {
|
||||||
util.GetLogger(r.req.Context()).WithError(err).Error("gomatrixserverlib.RespState failed")
|
return nil, fmt.Errorf("r.producer.SendEventWithState: %w", err)
|
||||||
res := jsonerror.InternalServerError()
|
|
||||||
return &res, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return &util.JSONResponse{
|
return &util.JSONResponse{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue