[server] Return 4xx for bad request (#3302)

## Description

## Tests
This commit is contained in:
Neeraj Gupta 2024-09-17 09:50:38 +05:30 committed by GitHub
parent c315bc9da1
commit 7911c14e40
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,7 @@
package api
import (
"fmt"
"net/http"
"strconv"
@ -140,7 +141,8 @@ func (h *PublicCollectionHandler) ReportAbuse(c *gin.Context) {
func (h *PublicCollectionHandler) GetDiff(c *gin.Context) {
sinceTime, err := strconv.ParseInt(c.Query("sinceTime"), 10, 64)
if err != nil {
handler.Error(c, stacktrace.Propagate(err, ""))
errorMessage := fmt.Sprintf("invalid sinceTime val: %s", c.Query("sinceTime"))
handler.Error(c, stacktrace.Propagate(ente.NewBadRequestWithMessage(errorMessage), err.Error()))
return
}
files, hasMore, err := h.CollectionCtrl.GetPublicDiff(c, sinceTime)