pub struct ContextError(pub RequestProtocol, pub ConnectError);Expand description
Error bundled with protocol for HTTP response formatting.
Used internally by the framework to carry protocol information alongside errors for proper JSON/Proto encoding in responses.
Tuple Fields§
§0: RequestProtocol§1: ConnectErrorImplementations§
Source§impl ContextError
impl ContextError
Sourcepub fn new(protocol: RequestProtocol, err: ConnectError) -> Self
pub fn new(protocol: RequestProtocol, err: ConnectError) -> Self
Create a new response error.
Sourcepub fn internal(protocol: RequestProtocol, _msg: impl Into<String>) -> Self
pub fn internal(protocol: RequestProtocol, _msg: impl Into<String>) -> Self
Create an internal error (hides details from client).
The provided message is not exposed to clients for security. Clients receive a generic “internal error” message.
Sourcepub fn protocol(&self) -> RequestProtocol
pub fn protocol(&self) -> RequestProtocol
Get the protocol.
Sourcepub fn error(&self) -> &ConnectError
pub fn error(&self) -> &ConnectError
Get the underlying ConnectError.
Sourcepub fn into_response(self) -> Response
pub fn into_response(self) -> Response
Convert to HTTP response with proper encoding.
Sourcepub fn into_connect_error(self) -> ConnectError
pub fn into_connect_error(self) -> ConnectError
Extract the underlying ConnectError.
Trait Implementations§
Source§impl Debug for ContextError
impl Debug for ContextError
Source§impl Display for ContextError
impl Display for ContextError
Source§impl Error for ContextError
impl Error for ContextError
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 ContextError
impl RefUnwindSafe for ContextError
impl Send for ContextError
impl Sync for ContextError
impl Unpin for ContextError
impl UnwindSafe for ContextError
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