pub enum Error {
Auth(String),
PermissionDenied {
message: String,
status: u16,
code: String,
context: String,
endpoint: String,
},
Validation(String),
Transport(String),
ResponseContract {
context: String,
message: String,
},
RateLimit {
message: String,
retry_after: Option<f64>,
},
Server(String),
Api {
message: String,
code: String,
metadata: Vec<(String, String)>,
},
RouteNotFound {
procedure: String,
},
Realtime(String),
QueueOverflow(String),
}Expand description
Polyester SDK error.
Variants§
Auth(String)
PermissionDenied
Validation(String)
Transport(String)
ResponseContract
A successful RPC returned a payload that violates the documented response contract.
This is not retryable: repeating a mutation blindly can duplicate work.
Because the server may already have accepted the mutation, callers must
reconcile when Self::mutation_outcome_unknown returns true.
RateLimit
Server(String)
Api
RouteNotFound
Realtime(String)
QueueOverflow(String)
Realtime subscription queue was full; the subscription fails instead of silently dropping updates.
Implementations§
Source§impl Error
impl Error
pub fn auth(msg: impl Into<String>) -> Self
pub fn validation(msg: impl Into<String>) -> Self
pub fn transport(msg: impl Into<String>) -> Self
pub fn response_contract( context: impl Into<String>, message: impl Into<String>, ) -> Self
pub fn realtime(msg: impl Into<String>) -> Self
pub fn queue_overflow(msg: impl Into<String>) -> Self
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Whether retrying may succeed after backoff.
This is a transport-level classification, not a guarantee that a
mutation was not applied. For mutations, preserve the same idempotency
key and reconcile server state before retrying when
Self::mutation_outcome_unknown is true.
Sourcepub fn mutation_outcome_unknown(&self) -> bool
pub fn mutation_outcome_unknown(&self) -> bool
Whether this error can occur after the server accepted a mutation.
Callers must treat these failures as ambiguous: reconcile first and reuse the original idempotency key if a retry is necessary.
Sourcepub fn retry_after(&self) -> Option<f64>
pub fn retry_after(&self) -> Option<f64>
Server-requested retry delay in seconds, when supplied.
Sourcepub fn auth_error_code(&self) -> Option<&str>
pub fn auth_error_code(&self) -> Option<&str>
Structured auth.v1.AuthErrorDetail code when this is an Error::Api.
Sourcepub fn is_mfa_enrollment_required(&self) -> bool
pub fn is_mfa_enrollment_required(&self) -> bool
True when the caller must enroll an MFA factor before continuing.
Sourcepub fn is_step_up_required(&self) -> bool
pub fn is_step_up_required(&self) -> bool
True when the caller must retry with a fresh X-Auth-Step-Up proof.
Sourcepub fn is_mfa_elevation_required(&self) -> bool
pub fn is_mfa_elevation_required(&self) -> bool
True when the caller needs a recent MFA-elevated interactive session.
Sourcepub fn is_mfa_last_factor_required(&self) -> bool
pub fn is_mfa_last_factor_required(&self) -> bool
True when the final active MFA factor cannot be removed.
Trait Implementations§
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()