Skip to main content

Code

Enum Code 

Source
#[non_exhaustive]
pub enum Code {
Show 26 variants InvalidToolInput, MutationRequired, QueryRequired, InvalidVariables, MissingGraphqlVariables, UndeclaredGraphqlVariables, UnsupportedGraphqlVariableType, UnsupportedGraphqlVariableDefault, InvalidGraphqlVariableValue, InvalidGraphqlQuery, InvalidGraphqlMutation, QueryNotAllowed, NotAMutation, ReservedMutationAlias, InvalidDateFilter, QueryForbidden, QueryTimeout, DatabaseUnavailable, QueryExecutionFailed, MutationExecutionFailed, MutationResultUnreadable, InvalidQueryResponse, InvalidMutationResponse, PaginationFailed, QueryDataFailed, Custom(String),
}
Expand description

A code the platform can translate, or one this action defines for itself.

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.
§

InvalidToolInput

The input could not be accepted at all.

§

MutationRequired

A write was asked for and no mutation document was given.

§

QueryRequired

A read was asked for and no query document was given.

§

InvalidVariables

The variables were not an object map.

§

MissingGraphqlVariables

The document declares variables the call did not supply.

§

UndeclaredGraphqlVariables

The call supplied variables the document does not declare.

§

UnsupportedGraphqlVariableType

A variable declaration uses a type the dialect does not carry.

§

UnsupportedGraphqlVariableDefault

A variable declaration carries a default, which is not supported.

§

InvalidGraphqlVariableValue

A variable value does not match its declaration.

§

InvalidGraphqlQuery

The query document was rejected.

§

InvalidGraphqlMutation

The mutation document was rejected.

§

QueryNotAllowed

A mutation was sent where only a read is allowed.

§

NotAMutation

A read was sent where only a mutation is allowed.

§

ReservedMutationAlias

A mutation root alias collides with a reserved result member.

§

InvalidDateFilter

A date or datetime filter is invalid.

§

QueryForbidden

The current user may not run the operation.

§

QueryTimeout

The read did not finish in time. Retryable.

§

DatabaseUnavailable

The data service is unavailable. Retryable.

§

QueryExecutionFailed

The read was accepted and then failed. Nothing was written.

§

MutationExecutionFailed

The write was accepted and then failed. It may have landed.

§

MutationResultUnreadable

The write ran and returned a result that could not be read.

§

InvalidQueryResponse

A read returned a response this action could not decode.

§

InvalidMutationResponse

A write returned a response this action could not decode.

§

PaginationFailed

Pagination metadata could not be produced.

§

QueryDataFailed

A failure with no more specific account of itself.

§

Custom(String)

A code this action defines. Translated generically, effect unknown.

Implementations§

Source§

impl Code

Source

pub fn as_str(&self) -> &str

The code exactly as it travels on the wire.

For Code::Custom this is the string as given, which may not be a shape the wire accepts; Code::wire is what the envelope emits.

Source

pub fn wire(&self) -> &str

The code as the envelope emits it.

A custom code that is not [A-Z0-9_], or is too short or too long, becomes UNSPECIFIED. A code travels as an opaque key, so the one that leaves here is always a key the failure can be filed under, and the substitution is one line to read at the point it happens.

Source

pub fn unspecified() -> Code

The generic code, for a failure the platform has no canonical name for.

A failure this SDK did not classify — a panic, an unencodable result, a host that answered nothing — establishes nothing about what the action had already done. This code claims exactly that much, which is why it is used in place of a canonical one that would say more.

Source

pub fn category(&self) -> Category

The category this code is reported under when nothing narrower is said.

Source

pub fn retryable(&self) -> bool

Whether repeating an identical call could plausibly succeed.

Only a confirmed timeout and a confirmed unavailability say yes, and the platform narrows even those with what it knows about the tool. It never widens them, so an action claiming a write failure is retryable is not believed — which is why this is derived here rather than asked for.

Trait Implementations§

Source§

impl Clone for Code

Source§

fn clone(&self) -> Code

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Code

Source§

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

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

impl Display for Code

Source§

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

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

impl Eq for Code

Source§

impl PartialEq for Code

Source§

fn eq(&self, other: &Code) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Code

Auto Trait Implementations§

§

impl Freeze for Code

§

impl RefUnwindSafe for Code

§

impl Send for Code

§

impl Sync for Code

§

impl Unpin for Code

§

impl UnsafeUnpin for Code

§

impl UnwindSafe for Code

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.