Skip to main content

Code

Enum Code 

Source
#[non_exhaustive]
pub enum Code {
Show 30 variants BadRequest = 0, ValidationFailed = 1, Unauthenticated = 2, SessionExpired = 3, MissingPermission = 4, PolicyDenied = 5, NotProvisioned = 6, ActAsPersonForbidden = 7, ProviderIsK2 = 8, QuotaExceeded = 9, NotFound = 10, MethodNotAllowed = 11, Conflict = 12, IdempotencyConflict = 13, ResyncRequired = 14, TooLarge = 15, InvalidState = 16, RateLimited = 17, Internal = 18, Unavailable = 19, RangeNotSatisfiable = 20, StorageFull = 21, MeetingEnded = 22, TooEarly = 23, LinkInvalid = 24, MeetingLocked = 25, LobbyFull = 26, KnockBlocked = 27, CursorExpired = 28, Unknown = 65_535,
}
Expand description

A stable machine error code. lower_snake; the HTTP status comes from Code::status.

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

BadRequest = 0

400: the request is malformed.

§

ValidationFailed = 1

400: a field failed validation; details.field names it.

§

Unauthenticated = 2

401: no or unknown credentials.

§

SessionExpired = 3

401: the session expired.

§

MissingPermission = 4

403: a permission bit is missing.

§

PolicyDenied = 5

403: an org policy forbids this.

§

NotProvisioned = 6

403: a valid pass for a principal with no Sew account.

§

ActAsPersonForbidden = 7

403: act-as targeted a person; only agents can be acted as.

§

ProviderIsK2 = 8

403: the command is off on a K2-provided install.

§

QuotaExceeded = 9

403: a quota or count limit is reached.

§

NotFound = 10

404: missing, or hidden from the caller (masked).

§

MethodNotAllowed = 11

405: only GET reads and POST mutations exist.

§

Conflict = 12

409: conflicts with current state.

§

IdempotencyConflict = 13

409: an Idempotency-Key was reused with a different body.

§

ResyncRequired = 14

410: the cursor is behind the change-log floor; details.floor says where.

§

TooLarge = 15

413: the body or a field is too large.

§

InvalidState = 16

422: valid request, but the target’s state forbids it.

§

RateLimited = 17

429: rate limited; details.retry_after_ms says when to retry.

§

Internal = 18

500: a server bug.

§

Unavailable = 19

503: temporarily unavailable.

§

RangeNotSatisfiable = 20

416: the byte range is outside the file; Content-Range: bytes */<size>.

§

StorageFull = 21

507: the server’s file storage is below its free-space floor.

§

MeetingEnded = 22

410: the meeting has ended or was cancelled (also a voice join in its channel).

§

TooEarly = 23

425: too early: the meeting opens at details.opens_at (also a voice join before starts_at − 15 min).

§

LinkInvalid = 24

404: a meeting link that is unknown, has a wrong secret, was revoked or rotated, or whose meeting ended or was cancelled (one body for all four).

§

MeetingLocked = 25

423: the meeting is locked.

§

LobbyFull = 26

429: the meeting’s lobby or room is full (max_waiting, max_guests_inside; nothing was written).

§

KnockBlocked = 27

403: this join nonce (or member) was turned away twice within 10 minutes and may not knock on this meeting for an hour.

§

CursorExpired = 28

410: the feed’s cursor is behind the pruned part of the log (the person notification feed); details.oldest_seq says where to resume.

§

Unknown = 65_535

A value this build does not know, sent by a newer peer. The server never sends it. Its discriminant is always UNKNOWN_DISCRIMINANT.

Implementations§

Source§

impl Code

Source

pub const ALL: &'static [Code]

Every known value in wire order, without Unknown.

Source

pub const fn as_str(self) -> &'static str

The wire string. Unknown gives "unknown".

Source

pub fn from_wire(s: &str) -> Option<Self>

Parses a wire string. Strings this build does not know give None.

Source

pub const fn is_unknown(self) -> bool

Whether this is the forward-compat Unknown value.

Source§

impl Code

Source

pub const fn status(self) -> u16

The HTTP status for this code. Unknown maps to 500.

Trait Implementations§

Source§

impl Clone for Code

Source§

fn clone(&self) -> Self

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 Copy for Code

Source§

impl Debug for Code

Source§

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

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

impl<'de> Deserialize<'de> for Code

Source§

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

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

impl Display for Code

Source§

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

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

impl Eq for Code

Source§

impl Hash for Code

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl JsonSchema for Code

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl PartialEq for Code

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl Serialize for Code

Source§

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

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

impl StructuralPartialEq for Code

Source§

impl UnitEnum for Code

Source§

fn all() -> &'static [Self]

Every known value, without Unknown.
Source§

fn wire_str(self) -> &'static str

The wire string.
Source§

fn is_unknown_value(self) -> bool

Whether this is the forward-compat Unknown value.

Auto Trait Implementations§

§

impl Forget for Code

§

impl Freeze for Code

§

impl Move 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.