Struct ErrorDetails
#[non_exhaustive]pub struct ErrorDetails { /* private fields */ }Expand description
Groups the standard error messages structs. Provides associated
functions and methods to setup and edit each error message independently.
Used when extracting error details from crate::Status, and when
creating a crate::Status with error details.
Implementations§
§impl ErrorDetails
impl ErrorDetails
pub fn new() -> ErrorDetails
pub fn new() -> ErrorDetails
Generates an ErrorDetails struct with all fields set to None.
pub fn with_retry_info(retry_delay: Option<Duration>) -> ErrorDetails
pub fn with_retry_info(retry_delay: Option<Duration>) -> ErrorDetails
Generates an ErrorDetails struct with RetryInfo details and
remaining fields set to None.
pub fn with_debug_info(
stack_entries: impl Into<Vec<String>>,
detail: impl Into<String>,
) -> ErrorDetails
pub fn with_debug_info( stack_entries: impl Into<Vec<String>>, detail: impl Into<String>, ) -> ErrorDetails
Generates an ErrorDetails struct with DebugInfo details and
remaining fields set to None.
pub fn with_quota_failure(
violations: impl Into<Vec<QuotaViolation>>,
) -> ErrorDetails
pub fn with_quota_failure( violations: impl Into<Vec<QuotaViolation>>, ) -> ErrorDetails
Generates an ErrorDetails struct with QuotaFailure details and
remaining fields set to None.
pub fn with_quota_failure_violation(
subject: impl Into<String>,
description: impl Into<String>,
) -> ErrorDetails
pub fn with_quota_failure_violation( subject: impl Into<String>, description: impl Into<String>, ) -> ErrorDetails
Generates an ErrorDetails struct with QuotaFailure details (one
QuotaViolation set) and remaining fields set to None.
pub fn with_error_info(
reason: impl Into<String>,
domain: impl Into<String>,
metadata: impl Into<HashMap<String, String>>,
) -> ErrorDetails
pub fn with_error_info( reason: impl Into<String>, domain: impl Into<String>, metadata: impl Into<HashMap<String, String>>, ) -> ErrorDetails
Generates an ErrorDetails struct with ErrorInfo details and
remaining fields set to None.
pub fn with_precondition_failure(
violations: impl Into<Vec<PreconditionViolation>>,
) -> ErrorDetails
pub fn with_precondition_failure( violations: impl Into<Vec<PreconditionViolation>>, ) -> ErrorDetails
Generates an ErrorDetails struct with PreconditionFailure
details and remaining fields set to None.
pub fn with_precondition_failure_violation(
violation_type: impl Into<String>,
subject: impl Into<String>,
description: impl Into<String>,
) -> ErrorDetails
pub fn with_precondition_failure_violation( violation_type: impl Into<String>, subject: impl Into<String>, description: impl Into<String>, ) -> ErrorDetails
Generates an ErrorDetails struct with PreconditionFailure
details (one PreconditionViolation set) and remaining fields set to
None.
pub fn with_bad_request(
field_violations: impl Into<Vec<FieldViolation>>,
) -> ErrorDetails
pub fn with_bad_request( field_violations: impl Into<Vec<FieldViolation>>, ) -> ErrorDetails
Generates an ErrorDetails struct with BadRequest details and
remaining fields set to None.
pub fn with_bad_request_violation(
field: impl Into<String>,
description: impl Into<String>,
) -> ErrorDetails
pub fn with_bad_request_violation( field: impl Into<String>, description: impl Into<String>, ) -> ErrorDetails
Generates an ErrorDetails struct with BadRequest details (one
FieldViolation set) and remaining fields set to None.
pub fn with_request_info(
request_id: impl Into<String>,
serving_data: impl Into<String>,
) -> ErrorDetails
pub fn with_request_info( request_id: impl Into<String>, serving_data: impl Into<String>, ) -> ErrorDetails
Generates an ErrorDetails struct with RequestInfo details and
remaining fields set to None.
pub fn with_resource_info(
resource_type: impl Into<String>,
resource_name: impl Into<String>,
owner: impl Into<String>,
description: impl Into<String>,
) -> ErrorDetails
pub fn with_resource_info( resource_type: impl Into<String>, resource_name: impl Into<String>, owner: impl Into<String>, description: impl Into<String>, ) -> ErrorDetails
Generates an ErrorDetails struct with ResourceInfo details and
remaining fields set to None.
pub fn with_help(links: impl Into<Vec<HelpLink>>) -> ErrorDetails
pub fn with_help(links: impl Into<Vec<HelpLink>>) -> ErrorDetails
Generates an ErrorDetails struct with Help details and
remaining fields set to None.
pub fn with_help_link(
description: impl Into<String>,
url: impl Into<String>,
) -> ErrorDetails
pub fn with_help_link( description: impl Into<String>, url: impl Into<String>, ) -> ErrorDetails
Generates an ErrorDetails struct with Help details (one
HelpLink set) and remaining fields set to None.
pub fn with_localized_message(
locale: impl Into<String>,
message: impl Into<String>,
) -> ErrorDetails
pub fn with_localized_message( locale: impl Into<String>, message: impl Into<String>, ) -> ErrorDetails
Generates an ErrorDetails struct with LocalizedMessage details
and remaining fields set to None.
pub fn retry_info(&self) -> Option<&RetryInfo>
pub fn retry_info(&self) -> Option<&RetryInfo>
Get RetryInfo details, if any.
pub fn debug_info(&self) -> Option<&DebugInfo>
pub fn debug_info(&self) -> Option<&DebugInfo>
Get DebugInfo details, if any.
pub fn quota_failure(&self) -> Option<&QuotaFailure>
pub fn quota_failure(&self) -> Option<&QuotaFailure>
Get QuotaFailure details, if any.
pub fn error_info(&self) -> Option<&ErrorInfo>
pub fn error_info(&self) -> Option<&ErrorInfo>
Get ErrorInfo details, if any.
pub fn precondition_failure(&self) -> Option<&PreconditionFailure>
pub fn precondition_failure(&self) -> Option<&PreconditionFailure>
Get PreconditionFailure details, if any.
pub fn bad_request(&self) -> Option<&BadRequest>
pub fn bad_request(&self) -> Option<&BadRequest>
Get BadRequest details, if any.
pub fn request_info(&self) -> Option<&RequestInfo>
pub fn request_info(&self) -> Option<&RequestInfo>
Get RequestInfo details, if any.
pub fn resource_info(&self) -> Option<&ResourceInfo>
pub fn resource_info(&self) -> Option<&ResourceInfo>
Get ResourceInfo details, if any.
pub fn localized_message(&self) -> Option<&LocalizedMessage>
pub fn localized_message(&self) -> Option<&LocalizedMessage>
Get LocalizedMessage details, if any.
pub fn set_retry_info(
&mut self,
retry_delay: Option<Duration>,
) -> &mut ErrorDetails
pub fn set_retry_info( &mut self, retry_delay: Option<Duration>, ) -> &mut ErrorDetails
Set RetryInfo details. Can be chained with other .set_ and
.add_ ErrorDetails methods.
pub fn set_debug_info(
&mut self,
stack_entries: impl Into<Vec<String>>,
detail: impl Into<String>,
) -> &mut ErrorDetails
pub fn set_debug_info( &mut self, stack_entries: impl Into<Vec<String>>, detail: impl Into<String>, ) -> &mut ErrorDetails
Set DebugInfo details. Can be chained with other .set_ and
.add_ ErrorDetails methods.
pub fn set_quota_failure(
&mut self,
violations: impl Into<Vec<QuotaViolation>>,
) -> &mut ErrorDetails
pub fn set_quota_failure( &mut self, violations: impl Into<Vec<QuotaViolation>>, ) -> &mut ErrorDetails
Set QuotaFailure details. Can be chained with other .set_ and
.add_ ErrorDetails methods.
pub fn add_quota_failure_violation(
&mut self,
subject: impl Into<String>,
description: impl Into<String>,
) -> &mut ErrorDetails
pub fn add_quota_failure_violation( &mut self, subject: impl Into<String>, description: impl Into<String>, ) -> &mut ErrorDetails
Adds a QuotaViolation to QuotaFailure details. Sets
QuotaFailure details if it is not set yet. Can be chained with
other .set_ and .add_ ErrorDetails methods.
pub fn has_quota_failure_violations(&self) -> bool
pub fn has_quota_failure_violations(&self) -> bool
Returns true if QuotaFailure is set and its violations vector
is not empty, otherwise returns false.
pub fn set_error_info(
&mut self,
reason: impl Into<String>,
domain: impl Into<String>,
metadata: impl Into<HashMap<String, String>>,
) -> &mut ErrorDetails
pub fn set_error_info( &mut self, reason: impl Into<String>, domain: impl Into<String>, metadata: impl Into<HashMap<String, String>>, ) -> &mut ErrorDetails
Set ErrorInfo details. Can be chained with other .set_ and
.add_ ErrorDetails methods.
pub fn set_precondition_failure(
&mut self,
violations: impl Into<Vec<PreconditionViolation>>,
) -> &mut ErrorDetails
pub fn set_precondition_failure( &mut self, violations: impl Into<Vec<PreconditionViolation>>, ) -> &mut ErrorDetails
Set PreconditionFailure details. Can be chained with other .set_
and .add_ ErrorDetails methods.
pub fn add_precondition_failure_violation(
&mut self,
violation_type: impl Into<String>,
subject: impl Into<String>,
description: impl Into<String>,
) -> &mut ErrorDetails
pub fn add_precondition_failure_violation( &mut self, violation_type: impl Into<String>, subject: impl Into<String>, description: impl Into<String>, ) -> &mut ErrorDetails
Adds a PreconditionViolation to PreconditionFailure details.
Sets PreconditionFailure details if it is not set yet. Can be
chained with other .set_ and .add_ ErrorDetails methods.
pub fn has_precondition_failure_violations(&self) -> bool
pub fn has_precondition_failure_violations(&self) -> bool
Returns true if PreconditionFailure is set and its violations
vector is not empty, otherwise returns false.
pub fn set_bad_request(
&mut self,
violations: impl Into<Vec<FieldViolation>>,
) -> &mut ErrorDetails
pub fn set_bad_request( &mut self, violations: impl Into<Vec<FieldViolation>>, ) -> &mut ErrorDetails
Set BadRequest details. Can be chained with other .set_ and
.add_ ErrorDetails methods.
pub fn add_bad_request_violation(
&mut self,
field: impl Into<String>,
description: impl Into<String>,
) -> &mut ErrorDetails
pub fn add_bad_request_violation( &mut self, field: impl Into<String>, description: impl Into<String>, ) -> &mut ErrorDetails
Adds a FieldViolation to BadRequest details. Sets
BadRequest details if it is not set yet. Can be chained with other
.set_ and .add_ ErrorDetails methods.
pub fn has_bad_request_violations(&self) -> bool
pub fn has_bad_request_violations(&self) -> bool
Returns true if BadRequest is set and its field_violations
vector is not empty, otherwise returns false.
pub fn set_request_info(
&mut self,
request_id: impl Into<String>,
serving_data: impl Into<String>,
) -> &mut ErrorDetails
pub fn set_request_info( &mut self, request_id: impl Into<String>, serving_data: impl Into<String>, ) -> &mut ErrorDetails
Set RequestInfo details. Can be chained with other .set_ and
.add_ ErrorDetails methods.
pub fn set_resource_info(
&mut self,
resource_type: impl Into<String>,
resource_name: impl Into<String>,
owner: impl Into<String>,
description: impl Into<String>,
) -> &mut ErrorDetails
pub fn set_resource_info( &mut self, resource_type: impl Into<String>, resource_name: impl Into<String>, owner: impl Into<String>, description: impl Into<String>, ) -> &mut ErrorDetails
Set ResourceInfo details. Can be chained with other .set_ and
.add_ ErrorDetails methods.
pub fn set_help(&mut self, links: impl Into<Vec<HelpLink>>) -> &mut ErrorDetails
pub fn set_help(&mut self, links: impl Into<Vec<HelpLink>>) -> &mut ErrorDetails
Set Help details. Can be chained with other .set_ and .add_
ErrorDetails methods.
pub fn add_help_link(
&mut self,
description: impl Into<String>,
url: impl Into<String>,
) -> &mut ErrorDetails
pub fn add_help_link( &mut self, description: impl Into<String>, url: impl Into<String>, ) -> &mut ErrorDetails
Adds a HelpLink to Help details. Sets Help details if it is
not set yet. Can be chained with other .set_ and .add_
ErrorDetails methods.
pub fn has_help_links(&self) -> bool
pub fn has_help_links(&self) -> bool
Returns true if Help is set and its links vector is not empty,
otherwise returns false.
pub fn set_localized_message(
&mut self,
locale: impl Into<String>,
message: impl Into<String>,
) -> &mut ErrorDetails
pub fn set_localized_message( &mut self, locale: impl Into<String>, message: impl Into<String>, ) -> &mut ErrorDetails
Set LocalizedMessage details. Can be chained with other .set_ and
.add_ ErrorDetails methods.
Trait Implementations§
§impl Clone for ErrorDetails
impl Clone for ErrorDetails
§fn clone(&self) -> ErrorDetails
fn clone(&self) -> ErrorDetails
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for ErrorDetails
impl Debug for ErrorDetails
§impl Default for ErrorDetails
impl Default for ErrorDetails
§fn default() -> ErrorDetails
fn default() -> ErrorDetails
Auto Trait Implementations§
impl Freeze for ErrorDetails
impl RefUnwindSafe for ErrorDetails
impl Send for ErrorDetails
impl Sync for ErrorDetails
impl Unpin for ErrorDetails
impl UnwindSafe for ErrorDetails
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more