diff options
author | Gianni Gambetti <99784476+ggambetti@users.noreply.github.com> | 2024-05-24 15:02:15 -0400 |
---|---|---|
committer | Gianni Gambetti <99784476+ggambetti@users.noreply.github.com> | 2024-05-27 11:16:34 -0400 |
commit | 4070322588104631421ebb03d80dc293d7d5a54f (patch) | |
tree | 0289af95f3f97c1a807663b5e2de97bfc04a9066 /plumbing/transport/http/common.go | |
parent | c7feada87363f96c224214ba309efd5cf5a886fc (diff) | |
download | go-git-4070322588104631421ebb03d80dc293d7d5a54f.tar.gz |
plumbing: transport/http, Wrap http errors to return reason. Fixes #1097
Diffstat (limited to 'plumbing/transport/http/common.go')
-rw-r--r-- | plumbing/transport/http/common.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/plumbing/transport/http/common.go b/plumbing/transport/http/common.go index 1c4ceee..120008d 100644 --- a/plumbing/transport/http/common.go +++ b/plumbing/transport/http/common.go @@ -430,11 +430,11 @@ func NewErr(r *http.Response) error { switch r.StatusCode { case http.StatusUnauthorized: - return transport.ErrAuthenticationRequired + return fmt.Errorf("%w: %s", transport.ErrAuthenticationRequired, reason) case http.StatusForbidden: - return transport.ErrAuthorizationFailed + return fmt.Errorf("%w: %s", transport.ErrAuthorizationFailed, reason) case http.StatusNotFound: - return transport.ErrRepositoryNotFound + return fmt.Errorf("%w: %s", transport.ErrRepositoryNotFound, reason) } return plumbing.NewUnexpectedError(&Err{r, reason}) |