#[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
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.
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
impl Code
Sourcepub fn as_str(&self) -> &str
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.
Sourcepub fn wire(&self) -> &str
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.
Sourcepub fn unspecified() -> Code
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.
Sourcepub fn category(&self) -> Category
pub fn category(&self) -> Category
The category this code is reported under when nothing narrower is said.
Sourcepub fn retryable(&self) -> bool
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.