add new error type

This commit is contained in:
2025-03-13 14:04:06 -07:00
parent 29fa401714
commit aa701237ff
2 changed files with 12 additions and 1 deletions

View File

@@ -104,7 +104,7 @@ func (c *Client) ConvertSpeechToTextFromReader(ctx context.Context, reader io.Re
case 422: case 422:
fallthrough fallthrough
default: default:
ve := types.ValidationError{} ve := types.ParamError{}
defer res.Body.Close() defer res.Body.Close()
jerr := json.NewDecoder(res.Body).Decode(&ve) jerr := json.NewDecoder(res.Body).Decode(&ve)
if jerr != nil { if jerr != nil {

View File

@@ -202,6 +202,17 @@ func (ve ValidationError) Error() string {
return fmt.Sprintf("%s %s: ", ve.Type_, ve.Msg) 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 { type VerificationAttemptResponseModel struct {
Text string `json:"text"` Text string `json:"text"`
DateUnix int32 `json:"date_unix"` DateUnix int32 `json:"date_unix"`