generate errors for ShortURL service using errata

This commit is contained in:
Emil Tullstedt
2022-12-19 14:25:44 +01:00
parent dbbae9f944
commit be1984cd36
2 changed files with 74 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
// Code generated by Errata. DO NOT EDIT.
// Errata Schema Version: 0.1
// Grafana errors schema version: 1
// Hash: 41882bb99ce21663b620467357c47a06
package errs
import (
"github.com/grafana/grafana/pkg/util/errutil"
)
var (
ErrShorturlAbsolutePath = errutil.NewBase(
errutil.StatusValidationFailed,
"shorturl.absolutePath",
errutil.WithPublicMessage(`Path should be relative`),
errutil.WithGuide(`Try removing any prefixing ` + "`" + `/` + "`" + ` to your path.`),
)
ErrShorturlBadRequest = errutil.NewBase(
errutil.StatusBadRequest,
"shorturl.badRequest",
errutil.WithPublicMessage(`Bad request`),
)
ErrShorturlInternal = errutil.NewBase(
errutil.StatusInternal,
"shorturl.internal",
errutil.WithPublicMessage(`Internal server error`),
)
ErrShorturlInvalidPath = errutil.NewBase(
errutil.StatusValidationFailed,
"shorturl.invalidPath",
errutil.WithPublicMessage(`Invalid short URL path`),
errutil.WithGuide(`There is something wrong with the path you've submitted. It might
contain unsupported characters or path-components .. to move up in the
hierarchy, which is not supported by the shorturl service.
`),
)
ErrShorturlNotFound = errutil.NewBase(
errutil.StatusNotFound,
"shorturl.notFound",
errutil.WithPublicMessage(`Could not find the specified short URL`),
)
)
+32
View File
@@ -0,0 +1,32 @@
version = "0.1"
error "shorturl.badRequest" {
message = "Bad request"
cause = "BadRequest"
}
error "shorturl.notFound" {
message = "Could not find the specified short URL"
cause = "NotFound"
}
error "shorturl.absolutePath" {
message = "Path should be relative"
cause = "ValidationFailed"
guide = "Try removing any prefixing `/` to your path."
}
error "shorturl.invalidPath" {
message = "Invalid short URL path"
cause = "ValidationFailed"
guide = <<EOF
There is something wrong with the path you've submitted. It might
contain unsupported characters or path-components .. to move up in the
hierarchy, which is not supported by the shorturl service.
EOF
}
error "shorturl.internal" {
message = "Internal server error"
cause = "Internal"
}