pub struct BridgeError {
pub code: ErrorCode,
pub message: String,
pub retryable: bool,
pub provider: Option<String>,
pub upstream_request_id: Option<String>,
pub details: BTreeMap<String, Value>,
}Expand description
Public, redaction-safe error returned by the bridge.
Fields§
§code: ErrorCodeStable machine-readable code.
message: StringHuman-readable message safe to show to a client.
retryable: boolWhether retrying later may succeed without changing the request.
provider: Option<String>Optional provider name, never a credential or account identifier.
upstream_request_id: Option<String>Safe provider correlation ID when one exists.
details: BTreeMap<String, Value>Structured, redaction-safe diagnostic values.
Implementations§
Source§impl BridgeError
impl BridgeError
Sourcepub fn new(code: ErrorCode, message: impl Into<String>) -> Self
pub fn new(code: ErrorCode, message: impl Into<String>) -> Self
Creates a non-retryable error without provider details.
Sourcepub fn safety_rejected(message: impl Into<String>) -> Self
pub fn safety_rejected(message: impl Into<String>) -> Self
Creates a safety rejection with stable, non-bypass recovery guidance.
Sourcepub fn with_provider(self, provider: impl Into<String>) -> Self
pub fn with_provider(self, provider: impl Into<String>) -> Self
Attaches a safe provider name.
Sourcepub fn with_detail(self, key: impl Into<String>, value: impl Serialize) -> Self
pub fn with_detail(self, key: impl Into<String>, value: impl Serialize) -> Self
Attaches a redaction-safe structured detail.
Trait Implementations§
Source§impl Clone for BridgeError
impl Clone for BridgeError
Source§fn clone(&self) -> BridgeError
fn clone(&self) -> BridgeError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BridgeError
impl Debug for BridgeError
Source§impl<'de> Deserialize<'de> for BridgeError
impl<'de> Deserialize<'de> for BridgeError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for BridgeError
impl Display for BridgeError
impl Eq for BridgeError
Source§impl Error for BridgeError
impl Error for BridgeError
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()
Source§impl JsonSchema for BridgeError
impl JsonSchema for BridgeError
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for BridgeError
impl PartialEq for BridgeError
Source§impl Serialize for BridgeError
impl Serialize for BridgeError
impl StructuralPartialEq for BridgeError
Auto Trait Implementations§
impl Freeze for BridgeError
impl RefUnwindSafe for BridgeError
impl Send for BridgeError
impl Sync for BridgeError
impl Unpin for BridgeError
impl UnsafeUnpin for BridgeError
impl UnwindSafe for BridgeError
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