mirror of
https://github.com/taigrr/elevenlabs.git
synced 2026-04-02 03:08:57 -07:00
add new error type
This commit is contained in:
@@ -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 {
|
||||||
|
|||||||
@@ -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"`
|
||||||
|
|||||||
Reference in New Issue
Block a user