pub struct RcpError {
pub code: i64,
pub message: String,
pub data: Option<Json>,
}Expand description
An RCP protocol or transport error.
Display renders "[RCP <code>] <message>" (matching every other SDK), and
the error carries the structured data payload (spec §12) plus retry hints.
Fields§
§code: i64§message: String§data: Option<Json>Implementations§
Source§impl RcpError
impl RcpError
pub fn new(code: i64, message: impl Into<String>) -> RcpError
pub fn with_data(code: i64, message: impl Into<String>, data: Json) -> RcpError
Sourcepub fn retryable(&self) -> bool
pub fn retryable(&self) -> bool
RateLimited / BackendUnavailable / Timeout are transient by default; an
explicit data.retryable overrides the code-based default (spec §12).
Sourcepub fn retry_after_ms(&self) -> i64
pub fn retry_after_ms(&self) -> i64
Server-suggested backoff in ms (data.retryAfterMs), or -1.
Trait Implementations§
Source§impl Error for RcpError
impl Error for RcpError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for RcpError
impl RefUnwindSafe for RcpError
impl Send for RcpError
impl Sync for RcpError
impl Unpin for RcpError
impl UnsafeUnpin for RcpError
impl UnwindSafe for RcpError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more