pub struct Error {
pub code: String,
pub message: String,
pub retryable: bool,
}Expand description
An error carried in a response or welcome, or produced by the host session on the agent’s behalf (a missing capability, a passed deadline, a lost connection).
On the wire: {0: code, 1: message, 2: retryable}.
Fields§
§code: StringStable snake_case code; see code.
message: StringHuman-readable description, including any hint for the user.
retryable: boolWhether sending the same request again can succeed.
Implementations§
Source§impl Error
impl Error
Sourcepub fn new(code: &str, message: impl Into<String>) -> Error
pub fn new(code: &str, message: impl Into<String>) -> Error
An error with code, retryable as retryable says (not retryable
for codes this version does not define).
Sourcepub fn unknown_method(method: Method) -> Error
pub fn unknown_method(method: Method) -> Error
The agent does not implement method.
Sourcepub fn capability_missing(method: Method, missing: Capabilities) -> Error
pub fn capability_missing(method: Method, missing: Capabilities) -> Error
method needs missing, which the agent did not advertise.
Sourcepub fn deadline_exceeded(method: Method, id: u32, deadline_ms: u32) -> Error
pub fn deadline_exceeded(method: Method, id: u32, deadline_ms: u32) -> Error
Request id for method did not finish within deadline_ms.
Sourcepub fn frame_too_large(method: Method, id: u32, size: u64, limit: u32) -> Error
pub fn frame_too_large(method: Method, id: u32, size: u64, limit: u32) -> Error
The method message for request id is size bytes, over limit.
Sourcepub fn disconnected(reason: impl Display) -> Error
pub fn disconnected(reason: impl Display) -> Error
The connection is gone because of reason; carries the reconnect hint.
Trait Implementations§
impl Eq for Error
Source§impl Error for Error
impl Error for Error
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()