Browse Source

Merge pull request #1050 from porter-dev/0.8.0-debug-gitrepos

[0.8.0] `/gitrepos` debug with user id
abelanger5 4 years ago
parent
commit
a7e95e11ec
1 changed files with 8 additions and 7 deletions
  1. 8 7
      server/api/integration_handler.go

+ 8 - 7
server/api/integration_handler.go

@@ -7,12 +7,6 @@ import (
 	"encoding/hex"
 	"encoding/json"
 	"fmt"
-	"github.com/go-chi/chi"
-	"github.com/google/go-github/github"
-	"github.com/porter-dev/porter/internal/forms"
-	"github.com/porter-dev/porter/internal/oauth"
-	"golang.org/x/oauth2"
-	"gorm.io/gorm"
 	"io/ioutil"
 	"net/http"
 	"net/url"
@@ -20,6 +14,13 @@ import (
 	"strconv"
 	"strings"
 
+	"github.com/go-chi/chi"
+	"github.com/google/go-github/github"
+	"github.com/porter-dev/porter/internal/forms"
+	"github.com/porter-dev/porter/internal/oauth"
+	"golang.org/x/oauth2"
+	"gorm.io/gorm"
+
 	"github.com/porter-dev/porter/internal/models/integrations"
 	ints "github.com/porter-dev/porter/internal/models/integrations"
 )
@@ -583,7 +584,7 @@ func (app *App) getGithubAppOauthTokenFromRequest(r *http.Request) (*oauth2.Toke
 	oauthInt, err := app.Repo.GithubAppOAuthIntegration.ReadGithubAppOauthIntegration(user.GithubAppIntegrationID)
 
 	if err != nil {
-		return nil, err
+		return nil, fmt.Errorf("Could not get GH app integration for user %d: %s", user.ID, err.Error())
 	}
 
 	_, _, err = oauth.GetAccessToken(oauthInt.SharedOAuthModel,