pub enum BackendError {
NotSupported(String),
Unavailable(String),
InvalidRequest(String),
Internal(String),
}Expand description
Why a backend call could not be satisfied. Each variant maps to exactly one
JSON-RPC error code (see BackendError::to_rpc_error), so a backend
picks the variant and never has to know the code.
Hand-rolled Display/Error rather than thiserror-derived (the usual
convention in docs/CODE_STANDARDS.md’s Error Handling) because this crate
keeps a deliberately minimal dependency set — the same trade its sibling
frust-devtools-protocol makes for DecodeError.
Variants§
NotSupported(String)
The backend does not implement this capability at all (the default
screenshot answer). Distinct from a transient failure: a client that
reads the handshake capability set should never have asked.
The capability exists but nothing can serve it right now (no attached window, no live widget tree yet, app backgrounded).
InvalidRequest(String)
The request itself was wrong (an id that names no widget, an out-of-range coordinate).
Internal(String)
Anything else the backend failed at.
Implementations§
Source§impl BackendError
impl BackendError
pub fn not_supported(what: impl Into<String>) -> Self
pub fn invalid_request(what: impl Into<String>) -> Self
pub fn internal(what: impl Into<String>) -> Self
Sourcepub fn to_rpc_error(&self) -> RpcError
pub fn to_rpc_error(&self) -> RpcError
The wire error this failure becomes.
Trait Implementations§
Source§impl Clone for BackendError
impl Clone for BackendError
Source§impl Debug for BackendError
impl Debug for BackendError
Source§impl Display for BackendError
impl Display for BackendError
impl Eq for BackendError
Source§impl Error for BackendError
impl Error for BackendError
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()