Chore: Remove Wrap (#50048)

* Chore: Remove Wrap and Wrapf

* Fix: Add error check
This commit is contained in:
Kat Yang
2022-06-03 09:24:24 +02:00
committed by GitHub
parent 53cb94a2ad
commit 3c3039f5b3
34 changed files with 104 additions and 117 deletions
+2 -2
View File
@@ -4,6 +4,7 @@ import (
"context"
"encoding/hex"
"errors"
"fmt"
"net/http"
"net/url"
"strings"
@@ -17,7 +18,6 @@ import (
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/services/secrets"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/util/errutil"
"github.com/grafana/grafana/pkg/web"
)
@@ -276,7 +276,7 @@ func (hs *HTTPServer) loginUserWithUser(user *models.User, c *models.ReqContext)
ctx := context.WithValue(c.Req.Context(), models.RequestURIKey{}, c.Req.RequestURI)
userToken, err := hs.AuthTokenService.CreateToken(ctx, user, ip, c.Req.UserAgent())
if err != nil {
return errutil.Wrap("failed to create auth token", err)
return fmt.Errorf("%v: %w", "failed to create auth token", err)
}
c.UserToken = userToken
+1 -2
View File
@@ -14,7 +14,6 @@ import (
"github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/plugins/backendplugin"
"github.com/grafana/grafana/pkg/util/errutil"
"github.com/grafana/grafana/pkg/util/proxyutil"
"github.com/grafana/grafana/pkg/web"
)
@@ -174,7 +173,7 @@ func (hs *HTTPServer) flushStream(stream callResourceClientResponseStream, w htt
}
if err != nil {
if processedStreams == 0 {
return errutil.Wrap("failed to receive response from resource call", err)
return fmt.Errorf("%v: %w", "failed to receive response from resource call", err)
}
hs.log.Error("Failed to receive response from resource call", "err", err)