Skip to main content

CanonicalError

Enum CanonicalError 

Source
#[non_exhaustive]
pub enum CanonicalError {
Show 16 variants
#[non_exhaustive]
Cancelled { ctx: Cancelled, detail: String, resource_type: Option<String>, resource_name: Option<String>, },
#[non_exhaustive]
Unknown { ctx: Unknown, detail: String, resource_type: Option<String>, resource_name: Option<String>, },
#[non_exhaustive]
InvalidArgument { ctx: InvalidArgument, detail: String, resource_type: Option<String>, resource_name: Option<String>, },
#[non_exhaustive]
DeadlineExceeded { ctx: DeadlineExceeded, detail: String, resource_type: Option<String>, resource_name: Option<String>, },
#[non_exhaustive]
NotFound { ctx: NotFound, detail: String, resource_type: Option<String>, resource_name: Option<String>, },
#[non_exhaustive]
AlreadyExists { ctx: AlreadyExists, detail: String, resource_type: Option<String>, resource_name: Option<String>, },
#[non_exhaustive]
PermissionDenied { ctx: PermissionDenied, detail: String, resource_type: Option<String>, resource_name: Option<String>, },
#[non_exhaustive]
ResourceExhausted { ctx: ResourceExhausted, detail: String, resource_type: Option<String>, resource_name: Option<String>, },
#[non_exhaustive]
FailedPrecondition { ctx: FailedPrecondition, detail: String, resource_type: Option<String>, resource_name: Option<String>, },
#[non_exhaustive]
Aborted { ctx: Aborted, detail: String, resource_type: Option<String>, resource_name: Option<String>, },
#[non_exhaustive]
OutOfRange { ctx: OutOfRange, detail: String, resource_type: Option<String>, resource_name: Option<String>, },
#[non_exhaustive]
Unimplemented { ctx: Unimplemented, detail: String, resource_type: Option<String>, resource_name: Option<String>, },
#[non_exhaustive]
Internal { ctx: Internal, detail: String, },
#[non_exhaustive]
ServiceUnavailable { ctx: ServiceUnavailable, detail: String, resource_type: Option<String>, resource_name: Option<String>, },
#[non_exhaustive]
DataLoss { ctx: DataLoss, detail: String, resource_type: Option<String>, resource_name: Option<String>, },
#[non_exhaustive]
Unauthenticated { ctx: Unauthenticated, detail: String, resource_type: Option<String>, resource_name: Option<String>, },
}

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

#[non_exhaustive]
Cancelled

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§detail: String
§resource_type: Option<String>
§resource_name: Option<String>
§

#[non_exhaustive]
Unknown

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§detail: String
§resource_type: Option<String>
§resource_name: Option<String>
§

#[non_exhaustive]
InvalidArgument

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§detail: String
§resource_type: Option<String>
§resource_name: Option<String>
§

#[non_exhaustive]
DeadlineExceeded

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§detail: String
§resource_type: Option<String>
§resource_name: Option<String>
§

#[non_exhaustive]
NotFound

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§detail: String
§resource_type: Option<String>
§resource_name: Option<String>
§

#[non_exhaustive]
AlreadyExists

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§detail: String
§resource_type: Option<String>
§resource_name: Option<String>
§

#[non_exhaustive]
PermissionDenied

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§detail: String
§resource_type: Option<String>
§resource_name: Option<String>
§

#[non_exhaustive]
ResourceExhausted

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§detail: String
§resource_type: Option<String>
§resource_name: Option<String>
§

#[non_exhaustive]
FailedPrecondition

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§detail: String
§resource_type: Option<String>
§resource_name: Option<String>
§

#[non_exhaustive]
Aborted

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§detail: String
§resource_type: Option<String>
§resource_name: Option<String>
§

#[non_exhaustive]
OutOfRange

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§detail: String
§resource_type: Option<String>
§resource_name: Option<String>
§

#[non_exhaustive]
Unimplemented

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§detail: String
§resource_type: Option<String>
§resource_name: Option<String>
§

#[non_exhaustive]
Internal

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§detail: String
§

#[non_exhaustive]
ServiceUnavailable

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§detail: String
§resource_type: Option<String>
§resource_name: Option<String>
§

#[non_exhaustive]
DataLoss

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§detail: String
§resource_type: Option<String>
§resource_name: Option<String>
§

#[non_exhaustive]
Unauthenticated

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§detail: String
§resource_type: Option<String>
§resource_name: Option<String>

Implementations§

Source§

impl CanonicalError

Source

pub fn internal( detail: impl Into<String>, ) -> ResourceErrorBuilder<ResourceAbsent, NoContext>

Source

pub fn service_unavailable() -> ServiceUnavailableBuilder

Source

pub fn unauthenticated() -> ResourceErrorBuilder<ResourceAbsent, NeedsReason>

Source§

impl CanonicalError

Source

pub fn detail(&self) -> &str

Source

pub fn resource_type(&self) -> Option<&str>

Source

pub fn resource_name(&self) -> Option<&str>

Source

pub fn diagnostic(&self) -> Option<&str>

Returns the internal diagnostic string for Internal and Unknown variants, or None for all other categories.

Middleware should call this before converting to Problem so that the real cause can be logged server-side with the trace_id. The diagnostic is never included in production wire responses.

Source

pub fn gts_type(&self) -> &'static str

Source

pub fn status_code(&self) -> u16

Source

pub fn title(&self) -> &'static str

Trait Implementations§

Source§

impl Clone for CanonicalError

Source§

fn clone(&self) -> CanonicalError

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CanonicalError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for CanonicalError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for CanonicalError

1.30.0 · Source§

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

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<CanonicalError> for Problem

Source§

fn from(err: CanonicalError) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for CanonicalError

Source§

fn from(err: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for CanonicalError

Source§

fn from(err: Error) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.