mirror of
https://github.com/aykhans/sarin.git
synced 2026-04-15 12:29:36 +00:00
feat: add CaptchaDecodeError type and retry transient HTTP errors during captcha polling
This commit is contained in:
@@ -520,6 +520,26 @@ func (e CaptchaRequestError) Unwrap() error {
|
||||
return e.Err
|
||||
}
|
||||
|
||||
type CaptchaDecodeError struct {
|
||||
Endpoint string
|
||||
Err error
|
||||
}
|
||||
|
||||
func NewCaptchaDecodeError(endpoint string, err error) CaptchaDecodeError {
|
||||
if err == nil {
|
||||
err = errNoError
|
||||
}
|
||||
return CaptchaDecodeError{Endpoint: endpoint, Err: err}
|
||||
}
|
||||
|
||||
func (e CaptchaDecodeError) Error() string {
|
||||
return fmt.Sprintf("captcha %s decode failed: %v", e.Endpoint, e.Err)
|
||||
}
|
||||
|
||||
func (e CaptchaDecodeError) Unwrap() error {
|
||||
return e.Err
|
||||
}
|
||||
|
||||
type CaptchaPollTimeoutError struct {
|
||||
TaskID string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user