mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-22 11:41:38 +00:00
Return 404 if event given to /context
was not found (#2245)
This commit is contained in:
parent
5592322e13
commit
72022a6ecf
@ -17,6 +17,7 @@ package routing
|
|||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@ -102,6 +103,12 @@ func Context(
|
|||||||
|
|
||||||
id, requestedEvent, err := syncDB.SelectContextEvent(ctx, roomID, eventID)
|
id, requestedEvent, err := syncDB.SelectContextEvent(ctx, roomID, eventID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if err == sql.ErrNoRows {
|
||||||
|
return util.JSONResponse{
|
||||||
|
Code: http.StatusNotFound,
|
||||||
|
JSON: jsonerror.NotFound(fmt.Sprintf("Event %s not found", eventID)),
|
||||||
|
}
|
||||||
|
}
|
||||||
logrus.WithError(err).WithField("eventID", eventID).Error("unable to find requested event")
|
logrus.WithError(err).WithField("eventID", eventID).Error("unable to find requested event")
|
||||||
return jsonerror.InternalServerError()
|
return jsonerror.InternalServerError()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user