diff --git a/client/stt.go b/client/stt.go index 712d9a6..70599fb 100644 --- a/client/stt.go +++ b/client/stt.go @@ -104,7 +104,7 @@ func (c *Client) ConvertSpeechToTextFromReader(ctx context.Context, reader io.Re case 422: fallthrough default: - ve := types.ValidationError{} + ve := types.ParamError{} defer res.Body.Close() jerr := json.NewDecoder(res.Body).Decode(&ve) if jerr != nil { diff --git a/client/types/types.go b/client/types/types.go index 12b488e..12fc8ae 100644 --- a/client/types/types.go +++ b/client/types/types.go @@ -202,6 +202,17 @@ func (ve ValidationError) Error() string { return fmt.Sprintf("%s %s: ", ve.Type_, ve.Msg) } +type ParamError struct { + Detail struct { + Status string `json:"status"` + Message string `json:"message"` + } `json:"detail"` +} + +func (pe ParamError) Error() string { + return fmt.Sprintf("%s %s: ", pe.Detail.Status, pe.Detail.Message) +} + type VerificationAttemptResponseModel struct { Text string `json:"text"` DateUnix int32 `json:"date_unix"`