This is an automated email from the ASF dual-hosted git repository.

abeizn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new 7812288a1 fix: bitbucket remote api swallows errors sliently (#7583)
7812288a1 is described below

commit 7812288a1015faab42bfa959ed731abf8dd71172
Author: Klesh Wong <[email protected]>
AuthorDate: Thu Jun 6 15:51:03 2024 +0800

    fix: bitbucket remote api swallows errors sliently (#7583)
---
 backend/plugins/bitbucket/api/remote_api.go | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/backend/plugins/bitbucket/api/remote_api.go 
b/backend/plugins/bitbucket/api/remote_api.go
index d81c0d027..2da3f7ab6 100644
--- a/backend/plugins/bitbucket/api/remote_api.go
+++ b/backend/plugins/bitbucket/api/remote_api.go
@@ -19,6 +19,7 @@ package api
 
 import (
        "fmt"
+       "io"
        "net/http"
        "net/url"
 
@@ -116,6 +117,13 @@ func listBitbucketRepos(
        if err != nil {
                return
        }
+       if res.StatusCode > 299 {
+               body, e := io.ReadAll(res.Body)
+               if e != nil {
+                       return nil, nil, errors.BadInput.Wrap(e, "failed to 
read response body")
+               }
+               return nil, nil, errors.BadInput.New(string(body))
+       }
        var resBody models.ReposResponse
        err = api.UnmarshalResponse(res, &resBody)
        if err != nil {

Reply via email to