Skip to content

Commit

Permalink
🐛 Fix error handling in commit message parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonBirchall committed Dec 28, 2024
1 parent 49993a9 commit 31a0fc0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ func getCommitMessages(diff []byte, openAIAPIKey string) []string {

body, _ := io.ReadAll(resp.Body)
var result map[string]interface{}
json.Unmarshal(body, &result)
err = json.Unmarshal(body, &result)
if err != nil {
fmt.Println("Error parsing response:", err)
return nil
}

choices, ok := result["choices"].([]interface{})
if !ok {
Expand Down

0 comments on commit 31a0fc0

Please sign in to comment.