pub enum ApiError {
Cloudflare {
detail: String,
},
BrowserGone {
detail: String,
},
AuthExpired,
StaleBuild {
wanted: Option<String>,
},
Api {
status: u16,
message: String,
},
InvalidRequest(String),
Other(Error),
}Expand description
Why a /kr-api/ call did not produce a usable answer.
ApiError::Cloudflare and ApiError::BrowserGone both relaunch against the
same profile; ApiError::AuthExpired must never touch it, or a transient failure
destroys a real login.
Variants§
Cloudflare
Bot mitigation. Relaunch against the same profile dir; never delete it.
Raised both by an API response that carries a Cloudflare fingerprint and by
the page load itself being rejected. Both need the same remedy, so both must
land here – a block during navigation reported as ApiError::Other would
silently bypass the relaunch that is the only remedy for it.
BrowserGone
The transport to Chrome died. The browser is broken, not the login it holds, so
the remedy is the same relaunch as ApiError::Cloudflare.
AuthExpired
The K-Plussa session is gone. Do not retry, do not touch the profile.
StaleBuild
X-K-Build-Number was absent or unparseable. Recoverable: the 409 that
reports it carries the real value in its own k-ruoka-build header.
Despite K-Ruoka’s wording (“Client version is too old”), this does not mean they deployed: the header is presence-checked and must parse as a number, but the value is never compared. In practice this fires on a process’s first call, before the header has been learned.
Api
The API understood us and said no.
InvalidRequest(String)
We rejected the request before sending it – a bad argument, not a K-Ruoka
failure. Kept separate so the message cannot imply that K-Ruoka was asked and
refused. It still reaches the caller as isError: true content like every
other tool failure, deliberately: the model is meant to read it and try
something else, which a JSON-RPC invalid_params does not guarantee.
Other(Error)
Trait Implementations§
Source§impl Error for ApiError
impl Error for ApiError
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()