Struct tonic_types::pb::Status
source · pub struct Status {
pub code: i32,
pub message: String,
pub details: Vec<Any>,
}
Expand description
The Status
type defines a logical error model that is suitable for
different programming environments, including REST APIs and RPC APIs. It is
used by gRPC. Each Status
message contains
three pieces of data: error code, error message, and error details.
You can find out more about this error model and how to work with it in the API Design Guide.
Fields§
§code: i32
The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
message: String
A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
details: Vec<Any>
A list of messages that carry the error details. There is a common set of message types for APIs to use.
Trait Implementations§
source§impl Message for Status
impl Message for Status
source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
source§fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>where
B: BufMut,
Self: Sized,
fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>where
B: BufMut,
Self: Sized,
source§fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
source§fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>where
B: BufMut,
Self: Sized,
fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>where
B: BufMut,
Self: Sized,
source§fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
source§fn decode<B>(buf: B) -> Result<Self, DecodeError>where
B: Buf,
Self: Default,
fn decode<B>(buf: B) -> Result<Self, DecodeError>where
B: Buf,
Self: Default,
source§fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>where
B: Buf,
Self: Default,
fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>where
B: Buf,
Self: Default,
source§fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>where
B: Buf,
Self: Sized,
fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>where
B: Buf,
Self: Sized,
self
. Read moresource§fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>where
B: Buf,
Self: Sized,
fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>where
B: Buf,
Self: Sized,
self
.source§impl PartialEq for Status
impl PartialEq for Status
source§impl RpcStatusExt for Status
impl RpcStatusExt for Status
source§fn check_error_details(&self) -> Result<ErrorDetails, DecodeError>
fn check_error_details(&self) -> Result<ErrorDetails, DecodeError>
pb::Status
are malformed or not. Tries to get an ErrorDetails
struct from a
pb::Status
. If some prost::DecodeError
occurs, it will be
returned. If not debugging, consider using
RpcStatusExt::get_error_details
or
RpcStatusExt::get_error_details_vec
.source§fn get_error_details(&self) -> ErrorDetails
fn get_error_details(&self) -> ErrorDetails
ErrorDetails
struct from pb::Status
. If some
prost::DecodeError
occurs, an empty ErrorDetails
struct will be
returned.source§fn check_error_details_vec(&self) -> Result<Vec<ErrorDetail>, DecodeError>
fn check_error_details_vec(&self) -> Result<Vec<ErrorDetail>, DecodeError>
pb::Status
are malformed or not. Tries to get a vector of ErrorDetail
enums
from a pb::Status
. If some prost::DecodeError
occurs, it will be
returned. If not debugging, consider using
StatusExt::get_error_details_vec
or
StatusExt::get_error_details
.source§fn get_error_details_vec(&self) -> Vec<ErrorDetail>
fn get_error_details_vec(&self) -> Vec<ErrorDetail>
ErrorDetail
enums from pb::Status
. If some
prost::DecodeError
occurs, an empty vector will be returned.source§fn get_details_retry_info(&self) -> Option<RetryInfo>
fn get_details_retry_info(&self) -> Option<RetryInfo>
RetryInfo
details found on pb::Status
, if any. If
some prost::DecodeError
occurs, returns None
.source§fn get_details_debug_info(&self) -> Option<DebugInfo>
fn get_details_debug_info(&self) -> Option<DebugInfo>
DebugInfo
details found on pb::Status
, if any. If
some prost::DecodeError
occurs, returns None
.source§fn get_details_quota_failure(&self) -> Option<QuotaFailure>
fn get_details_quota_failure(&self) -> Option<QuotaFailure>
QuotaFailure
details found on pb::Status
, if any.
If some prost::DecodeError
occurs, returns None
.source§fn get_details_error_info(&self) -> Option<ErrorInfo>
fn get_details_error_info(&self) -> Option<ErrorInfo>
ErrorInfo
details found on pb::Status
, if any. If
some prost::DecodeError
occurs, returns None
.source§fn get_details_precondition_failure(&self) -> Option<PreconditionFailure>
fn get_details_precondition_failure(&self) -> Option<PreconditionFailure>
PreconditionFailure
details found on pb::Status
,
if any. If some prost::DecodeError
occurs, returns None
.source§fn get_details_bad_request(&self) -> Option<BadRequest>
fn get_details_bad_request(&self) -> Option<BadRequest>
BadRequest
details found on pb::Status
, if any. If
some prost::DecodeError
occurs, returns None
.source§fn get_details_request_info(&self) -> Option<RequestInfo>
fn get_details_request_info(&self) -> Option<RequestInfo>
RequestInfo
details found on pb::Status
, if any.
If some prost::DecodeError
occurs, returns None
.source§fn get_details_resource_info(&self) -> Option<ResourceInfo>
fn get_details_resource_info(&self) -> Option<ResourceInfo>
ResourceInfo
details found on pb::Status
, if any.
If some prost::DecodeError
occurs, returns None
.source§fn get_details_help(&self) -> Option<Help>
fn get_details_help(&self) -> Option<Help>
Help
details found on pb::Status
, if any. If some
prost::DecodeError
occurs, returns None
.source§fn get_details_localized_message(&self) -> Option<LocalizedMessage>
fn get_details_localized_message(&self) -> Option<LocalizedMessage>
LocalizedMessage
details found on pb::Status
, if
any. If some prost::DecodeError
occurs, returns None
.impl StructuralPartialEq for Status
Auto Trait Implementations§
impl RefUnwindSafe for Status
impl Send for Status
impl Sync for Status
impl Unpin for Status
impl UnwindSafe for Status
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request