Skip to content

Commit

Permalink
Merge pull request #8 from natrongmbh/disable-teams
Browse files Browse the repository at this point in the history
handle unmarshall error
  • Loading branch information
janlauber authored Sep 1, 2022
2 parents a1ac9e6 + d8ef6ab commit 3ee6342
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/backend/controllers/authController.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,14 @@ func LoggedIn(c *fiber.Ctx, githubCode string) error {

var githubTeamsDataMap []map[string]interface{}
if err := json.Unmarshal([]byte(githubTeamsData), &githubTeamsDataMap); err != nil {
// githubTeamsData contains "message": "Bad credentials"
if strings.Contains(githubTeamsData, "Bad credentials") {
return c.Status(500).JSON(fiber.Map{
"status": "error",
"message": "Bad credentials",
})
}
util.ErrorLogger.Printf("Error unmarshalling github teams data: %s", err)
githubTeamsDataMap = []map[string]interface{}{}
}

var githubUserDataMap map[string]interface{}
Expand Down

0 comments on commit 3ee6342

Please sign in to comment.