Enum TwirpErrorCode

Source
pub enum TwirpErrorCode {
Show 18 variants Canceled, Unknown, InvalidArgument, Malformed, DeadlineExceeded, NotFound, BadRoute, AlreadyExists, PermissionDenied, Unauthenticated, ResourceExhausted, FailedPrecondition, Aborted, OutOfRange, Unimplemented, Internal, Unavailable, Dataloss,
}
Expand description

A Twirp error code

Variants§

§

Canceled

The operation was cancelled.

§

Unknown

An unknown error occurred. For example, this can be used when handling errors raised by APIs that do not return any error information.

§

InvalidArgument

The client specified an invalid argument. This indicates arguments that are invalid regardless of the state of the system (i.e. a malformed file name, required argument, number out of range, etc.).

§

Malformed

The client sent a message which could not be decoded. This may mean that the message was encoded improperly or that the client and server have incompatible message definitions.

§

DeadlineExceeded

Operation expired before completion. For operations that change the state of the system, this error may be returned even if the operation has completed successfully (timeout).

§

NotFound

Some requested entity was not found.

§

BadRoute

The requested URL path wasn’t routable to a Twirp service and method. This is returned by generated server code and should not be returned by application code (use “not_found” or “unimplemented” instead).

§

AlreadyExists

An attempt to create an entity failed because one already exists.

§

PermissionDenied

The caller does not have permission to execute the specified operation. It must not be used if the caller cannot be identified (use “unauthenticated” instead).

§

Unauthenticated

The request does not have valid authentication credentials for the operation.

§

ResourceExhausted

Some resource has been exhausted or rate-limited, perhaps a per-user quota, or perhaps the entire file system is out of space.

§

FailedPrecondition

The operation was rejected because the system is not in a state required for the operation’s execution. For example, doing an rmdir operation on a directory that is non-empty, or on a non-directory object, or when having conflicting read-modify-write on the same resource.

§

Aborted

The operation was aborted, typically due to a concurrency issue like sequencer check failures, transaction aborts, etc.

§

OutOfRange

The operation was attempted past the valid range. For example, seeking or reading past end of a paginated collection. Unlike “invalid_argument”, this error indicates a problem that may be fixed if the system state changes (i.e. adding more items to the collection). There is a fair bit of overlap between “failed_precondition” and “out_of_range”. We recommend using “out_of_range” (the more specific error) when it applies so that callers who are iterating through a space can easily look for an “out_of_range” error to detect when they are done.

§

Unimplemented

The operation is not implemented or not supported/enabled in this service.

§

Internal

When some invariants expected by the underlying system have been broken. In other words, something bad happened in the library or backend service. Twirp specific issues like wire and serialization problems are also reported as “internal” errors.

§

Unavailable

The service is currently unavailable. This is most likely a transient condition and may be corrected by retrying with a backoff.

§

Dataloss

The operation resulted in unrecoverable data loss or corruption.

Trait Implementations§

Source§

impl Clone for TwirpErrorCode

Source§

fn clone(&self) -> TwirpErrorCode

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 TwirpErrorCode

Source§

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

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

impl<'de> Deserialize<'de> for TwirpErrorCode

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<TwirpErrorCode, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<Code> for TwirpErrorCode

Source§

fn from(code: Code) -> TwirpErrorCode

Converts to this type from the input type.
Source§

impl PartialEq for TwirpErrorCode

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for TwirpErrorCode

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for TwirpErrorCode

Source§

impl Eq for TwirpErrorCode

Source§

impl StructuralPartialEq for TwirpErrorCode

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> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
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, 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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,