pub struct EzError {
pub request_id: Option<String>,
pub task_id: Option<String>,
pub error_code: Option<String>,
pub error_description: Option<String>,
pub errors: BTreeMap<String, String>,
pub http_status: u16,
}Expand description
Structured error returned by the EzCaptchaSolver API.
Fields§
§request_id: Option<String>Optional server request identifier.
task_id: Option<String>Optional task identifier for errors returned after task creation.
error_code: Option<String>Stable machine-readable error code.
error_description: Option<String>Human-readable error description.
errors: BTreeMap<String, String>Field-level validation errors.
http_status: u16HTTP status code that carried the API error.
Implementations§
Source§impl EzError
impl EzError
Sourcepub fn is_authentication_error(&self) -> bool
pub fn is_authentication_error(&self) -> bool
Returns true when this is a credential or balance problem.
A caller that retries one of these is not merely wasting a call: the service counts them per key, and thirty within a minute earn a three-minute ban. Stop rather than back off.
Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Returns true when resending the identical request would fail identically.
An unrecognised code returns false, because a code this release has not
seen may well be transient and the SDK should not talk a caller out of a
retry that would have worked. false is not a promise that retrying is
safe — the retry policy stays with the caller.
Sourcepub fn is_rate_limited(&self) -> bool
pub fn is_rate_limited(&self) -> bool
Returns true when the service refused the request for throttling rather than for anything about the request itself.
Both codes are transient by construction: a rate limit resets with its
window and a ban expires on its own. The asynchronous polling loop
treats one as a skipped attempt instead of a failed task, and a caller
polling by hand with get_task_result should do the same.
This is narrower than the complement of Self::is_terminal, which is
false for every unrecognised code as well — including the worker codes
that report a genuinely failed task.
Trait Implementations§
impl Eq for EzError
Source§impl Error for EzError
impl Error for EzError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()