Skip to content

Commit

Permalink
error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio committed May 25, 2023
1 parent a0ef650 commit 3512e01
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions auth/OpenAiAuth.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,5 +378,10 @@ func (auth *Authenticator) GetAccessToken() (string, Error) {
return "", *NewError("get_access_token", 0, "", err)
}

// Check if access token in data
if _, ok := data["access_token"]; !ok {
return "", *NewError("get_access_token", 0, "Missing access token", fmt.Errorf("error: Check details"))
}

return data["access_token"].(string), Error{}
}

0 comments on commit 3512e01

Please sign in to comment.