diff --git a/pkg/models/errs/shorturl.gen.go b/pkg/models/errs/shorturl.gen.go new file mode 100644 index 00000000000..e53ff7ea890 --- /dev/null +++ b/pkg/models/errs/shorturl.gen.go @@ -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`), + ) +) diff --git a/pkg/models/errs/shorturl.hcl b/pkg/models/errs/shorturl.hcl new file mode 100644 index 00000000000..2f66adfd8a8 --- /dev/null +++ b/pkg/models/errs/shorturl.hcl @@ -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 = <