Skip to content

Commit 2230127

Browse files
committed
Accounted for empty responses
1 parent c24e211 commit 2230127

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

voice/transcription.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,9 @@ func CreateTranscription(client *messagebird.Client, callID string, legID string
103103
if err := client.Request(&resp, http.MethodPost, apiRoot+path, body); err != nil {
104104
return nil, err
105105
}
106+
if len(resp.Data) == 0 {
107+
return nil, fmt.Errorf("Empty response")
108+
}
109+
106110
return &resp.Data[0], nil
107111
}

0 commit comments

Comments
 (0)