Add logging for invalid model errors (#126)
Add logging for invalid model errors Co-authored-by: kolaente <k@knt.li> Reviewed-on: https://kolaente.dev/vikunja/api/pulls/126
This commit is contained in:
7
vendor/code.vikunja.io/web/handler/delete.go
generated
vendored
7
vendor/code.vikunja.io/web/handler/delete.go
generated
vendored
@ -16,6 +16,7 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/labstack/echo/v4"
|
||||
"net/http"
|
||||
)
|
||||
@ -32,7 +33,11 @@ func (c *WebHandler) DeleteWeb(ctx echo.Context) error {
|
||||
|
||||
// Bind params to struct
|
||||
if err := ctx.Bind(currentStruct); err != nil {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, "Invalid URL param.")
|
||||
config.LoggingProvider.Debugf("Invalid model error. Internal error was: %s", err.Error())
|
||||
if he, is := err.(*echo.HTTPError); is {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid model provided. Error was: %s", he.Message))
|
||||
}
|
||||
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid model provided."))
|
||||
}
|
||||
|
||||
// Check if the user has the right to delete
|
||||
|
Reference in New Issue
Block a user