2022-12-03 03:20:49 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/labstack/echo/v4"
|
|
|
|
"github.com/pkg/errors"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
ErrInvalidRequestFormat = echo.NewHTTPError(http.StatusBadRequest, "invalid_request_format")
|
2022-12-04 19:50:55 +00:00
|
|
|
ErrInvalidSession = echo.NewHTTPError(http.StatusBadRequest)
|
2022-12-03 03:20:49 +00:00
|
|
|
ErrSessionNotAvailable = echo.NewHTTPError(http.StatusInternalServerError, "session_not_available")
|
|
|
|
)
|
|
|
|
|
|
|
|
func wrapValidationError(err error) error {
|
|
|
|
wrapped := errors.Wrap(err, "validation_failed")
|
|
|
|
return echo.NewHTTPError(http.StatusBadRequest, wrapped.Error())
|
|
|
|
}
|