1
0
mirror of https://github.com/techknowlogick/faas-lgtmbot synced 2024-11-22 15:02:02 +01:00

return on error

This commit is contained in:
Matti R 2021-02-11 13:43:58 -05:00
parent ac7decb6a4
commit cc9ec6c4d5
No known key found for this signature in database
GPG Key ID: 9D8A57ADAA232E95

@ -1,11 +1,11 @@
package function package function
import ( import (
"code.gitea.io/sdk/gitea"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"strings" "strings"
"code.gitea.io/sdk/gitea"
scm "github.com/jenkins-x/go-scm/scm" scm "github.com/jenkins-x/go-scm/scm"
giteaWebhook "github.com/jenkins-x/go-scm/scm/driver/gitea" giteaWebhook "github.com/jenkins-x/go-scm/scm/driver/gitea"
) )
@ -50,11 +50,13 @@ func Handle(w http.ResponseWriter, r *http.Request) {
if err != nil { if err != nil {
// failed to get secret // failed to get secret
w.WriteHeader(http.StatusInternalServerError) w.WriteHeader(http.StatusInternalServerError)
return
} }
giteaClient, err := gitea.NewClient(string(giteaHost), gitea.SetToken(string(giteaToken))) giteaClient, err := gitea.NewClient(string(giteaHost), gitea.SetToken(string(giteaToken)))
if err != nil { if err != nil {
// failed to setup gitea client // failed to setup gitea client
w.WriteHeader(http.StatusInternalServerError) w.WriteHeader(http.StatusInternalServerError)
return
} }
// fetch PR and approvals // fetch PR and approvals