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
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.
Proposed changes
When
http.StatusBadRequest
returnStatusError
instead offmt.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 ofhttp.StatusBadRequest
Possible Implementation
https://github.com/deepgram/deepgram-go-sdk/blob/main/pkg/client/common/common.go#L94
Other information
-