Files
comicverse/lib/router/rerrors/400s.go
Gustavo L de Mello (Guz) 218b991caa refactor(lib): move app routing to lib package
These packages and functions under lib will one day be part of it's
dedicated library/framework, so separating them here helps for the
future.
2024-10-23 19:06:03 -03:00

27 lines
721 B
Go

package rerrors
import "net/http"
func NotFound() RouteError {
return NewRouteError(http.StatusNotFound, "Not Found", map[string]any{})
}
func MissingParameters(params []string) RouteError {
return NewRouteError(http.StatusBadRequest, "Missing parameters", map[string]any{
"missing_parameters": params,
})
}
func MissingCookies(cookies []string) RouteError {
return NewRouteError(http.StatusBadRequest, "Missing cookies", map[string]any{
"missing_cookies": cookies,
})
}
func MethodNowAllowed(method string, allowedMethods []string) RouteError {
return NewRouteError(http.StatusMethodNotAllowed, "Method not allowed", map[string]any{
"method": method,
"allowed_methods": allowedMethods,
})
}