ShortURL: Use new Error type (#50859)

This commit is contained in:
Emil Tullstedt
2022-06-15 15:11:36 +02:00
committed by GitHub
parent f82264c2b1
commit f1834163ec
5 changed files with 40 additions and 25 deletions
+7 -2
View File
@@ -1,12 +1,17 @@
package models
import (
"errors"
"time"
"github.com/grafana/grafana/pkg/util/errutil"
)
var (
ErrShortURLNotFound = errors.New("short URL not found")
ErrShortURLBadRequest = errutil.NewBase(errutil.StatusBadRequest, "shorturl.bad-request")
ErrShortURLNotFound = errutil.NewBase(errutil.StatusNotFound, "shorturl.not-found")
ErrShortURLAbsolutePath = errutil.NewBase(errutil.StatusValidationFailed, "shorturl.absolute-path", errutil.WithPublicMessage("Path should be relative"))
ErrShortURLInvalidPath = errutil.NewBase(errutil.StatusValidationFailed, "shorturl.invalid-path", errutil.WithPublicMessage("Invalid short URL path"))
ErrShortURLInternal = errutil.NewBase(errutil.StatusInternal, "shorturl.internal")
)
type ShortUrl struct {