Skip to content

Commit

Permalink
Handle error
Browse files Browse the repository at this point in the history
Signed-off-by: GitHub <[email protected]>
  • Loading branch information
rajbos authored Apr 13, 2023
1 parent b443372 commit 8ab5e6d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion clients/githubrepo/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,16 @@ func CreateGithubRepoClientWithTransport(ctx context.Context, rt http.RoundTripp
// load the server url from the api url
ghithubSERVERURL = strings.TrimSuffix(githubAPIURL, "/api/v3")
}
// trim trailing slash to prevent issues with the graphql client
ghithubSERVERURL = strings.TrimSuffix(ghithubSERVERURL, "/")
githubGRAPHQLURL := fmt.Sprintf("%s/api/graphql", ghithubSERVERURL)

client, _ = github.NewEnterpriseClient(githubAPIURL, githubAPIURL, httpClient)
var err error
client, err = github.NewEnterpriseClient(githubAPIURL, githubAPIURL, httpClient)
if err != nil {
panic(fmt.Errorf("error during CreateGithubRepoClientWithTransport: %v", err))
}

graphClient = githubv4.NewEnterpriseClient(githubGRAPHQLURL, httpClient)
} else {
// use the defaul url values from the github client
Expand Down

0 comments on commit 8ab5e6d

Please sign in to comment.