Chore: Add errutils helpers (#73577)
Add helpers for the errutil package in favor of errutil.NewBase.
This commit is contained in:
@@ -11,7 +11,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/util/errutil"
|
||||
)
|
||||
|
||||
var ErrNonGrafanaError = errutil.NewBase(errutil.StatusInternal, "core.MalformedError")
|
||||
var ErrNonGrafanaError = errutil.Internal("core.MalformedError")
|
||||
var defaultLogger = log.New("requestErrors")
|
||||
|
||||
// ErrorOptions is a container for functional options passed to [Write].
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
func TestWrite(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
const msgID = "test.thisIsExpected"
|
||||
base := errutil.NewBase(errutil.StatusTimeout, msgID)
|
||||
base := errutil.Timeout(msgID)
|
||||
handler := func(writer http.ResponseWriter, request *http.Request) {
|
||||
Write(ctx, base.Errorf("got expected error"), writer)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user