mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-16 19:33:09 -06:00
Remove unknownRoomError, use unmarshalError when unable to get room ID
This commit is contained in:
parent
e66344587b
commit
e55bc08c92
|
|
@ -79,7 +79,6 @@ func Send(
|
|||
JSON: resp,
|
||||
}
|
||||
// Handle known error cases as we will return a 400 error for these.
|
||||
case unknownRoomError:
|
||||
case roomNotFoundError:
|
||||
case unmarshalError:
|
||||
case verifySigError:
|
||||
|
|
@ -117,7 +116,7 @@ func (t *txnReq) processTransaction() (*gomatrixserverlib.RespSend, error) {
|
|||
}
|
||||
if err := json.Unmarshal(pdu, &header); err != nil {
|
||||
util.GetLogger(t.context).WithError(err).Warn("Transaction: Failed to extract room ID from event")
|
||||
return nil, unknownRoomError{}
|
||||
return nil, unmarshalError{err}
|
||||
}
|
||||
verReq := api.QueryRoomVersionForRoomRequest{RoomID: header.RoomID}
|
||||
verRes := api.QueryRoomVersionForRoomResponse{}
|
||||
|
|
@ -178,7 +177,6 @@ func (t *txnReq) processTransaction() (*gomatrixserverlib.RespSend, error) {
|
|||
return &gomatrixserverlib.RespSend{PDUs: results}, nil
|
||||
}
|
||||
|
||||
type unknownRoomError struct{}
|
||||
type roomNotFoundError struct {
|
||||
roomID string
|
||||
}
|
||||
|
|
@ -190,7 +188,6 @@ type verifySigError struct {
|
|||
err error
|
||||
}
|
||||
|
||||
func (e unknownRoomError) Error() string { return "unable to extract room ID" }
|
||||
func (e roomNotFoundError) Error() string { return fmt.Sprintf("room %q not found", e.roomID) }
|
||||
func (e unmarshalError) Error() string { return fmt.Sprintf("unable to parse event: %s", e.err) }
|
||||
func (e verifySigError) Error() string {
|
||||
|
|
|
|||
Loading…
Reference in a new issue