Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[server] Return empty json on error

Neeraj Gupta86b0c820659b
diff --git a/server/pkg/utils/handler/handler.go b/server/pkg/utils/handler/handler.go
index c264fb452d..542057a0df 100644
--- a/server/pkg/utils/handler/handler.go
+++ b/server/pkg/utils/handler/handler.go
@@ -53,14 +53,14 @@ func Error(c *gin.Context, err error) {
if isEnteApiErr {
c.AbortWithStatusJSON(enteApiErr.HttpStatusCode, enteApiErr)
} else if httpStatus := httpStatusCode(err); httpStatus != 0 {
- c.AbortWithStatus(httpStatus)
+ c.AbortWithStatusJSON(httpStatus, gin.H{})
} else {
if _, ok := stacktrace.RootCause(err).(validator.ValidationErrors); ok {
- c.AbortWithStatus(http.StatusBadRequest)
+ c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{})
} else if isClientError {
- c.AbortWithStatus(http.StatusBadRequest)
+ c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{})
} else {
- c.AbortWithStatus(http.StatusInternalServerError)
+ c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{})
}
}
}