deepgram / deepgram-go-sdk

Go SDK for Deepgram's automated speech recognition APIs.
https://developers.deepgram.com
MIT License
31 stars 27 forks source link

Improved ErrorHandling for BadRequest #218

Closed dmalmkvist closed 4 months ago

dmalmkvist commented 4 months ago

Proposed changes

When http.StatusBadRequest return StatusError instead of fmt.Errorf

Context

This would simplify and make our error handling and reporting better. We expected that Deepgram request would return a StatusError with the HTTP status code, but is normally the case with the exception of http.StatusBadRequest

Possible Implementation

https://github.com/deepgram/deepgram-go-sdk/blob/main/pkg/client/common/common.go#L94

Other information

-

dvonthenen commented 4 months ago

It looks like the Deepgram Error Message was never implemented. I am working on a fix that should get you where, in most cases, it returns StatusError.

dvonthenen commented 4 months ago

PR merged. Will have a release this week.