pub struct ServerError { /* private fields */ }Expand description
Error answer to a call.
It is sent as trailers: grpc-status, grpc-message and any extra
headers. Hand-written services return it directly. With #[server], a
method returns it to fail the call (see MethodResult and
StreamResult); it is also produced for unknown methods and requests
that cannot be decoded.
Implementations§
Source§impl ServerError
impl ServerError
Sourcepub fn new(
status: GrpcStatus,
message: HeaderValue,
headers: Option<HeaderMap>,
) -> Self
pub fn new( status: GrpcStatus, message: HeaderValue, headers: Option<HeaderMap>, ) -> Self
Create an error from a status, a grpc-message text and extra
trailers.
The message is sent as is. The gRPC spec expects it to be
percent-encoded, build it with
encode_grpc_message().
Trait Implementations§
Source§impl Clone for ServerError
impl Clone for ServerError
Source§impl Debug for ServerError
impl Debug for ServerError
Source§impl Display for ServerError
impl Display for ServerError
Source§impl Error for ServerError
impl Error for ServerError
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 From<DecodeError> for ServerError
impl From<DecodeError> for ServerError
Source§fn from(_: DecodeError) -> Self
fn from(_: DecodeError) -> Self
Converts to this type from the input type.
Source§impl From<StreamError> for ServerError
impl From<StreamError> for ServerError
Source§fn from(err: StreamError) -> Self
fn from(err: StreamError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Forget for ServerError
impl Freeze for ServerError
impl Move for ServerError
impl RefUnwindSafe for ServerError
impl Send for ServerError
impl Sync for ServerError
impl Unpin for ServerError
impl UnsafeUnpin for ServerError
impl UnwindSafe for ServerError
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FromRequest<T> for T
impl<T> FromRequest<T> for T
Source§impl<T> MethodResult<T> for T
impl<T> MethodResult<T> for T
Source§fn into_response(self) -> Result<Response<T>, ServerError>
fn into_response(self) -> Result<Response<T>, ServerError>
Turn into the reply, or the error the call ends with. Read more