Skip to main content

ErrorCode

Enum ErrorCode 

Source
#[non_exhaustive]
#[repr(u32)]
pub enum ErrorCode { Ok = 0, VersionMismatch = 1, InvalidHeader = 2, InvalidQuery = 3, InvalidBody = 4, ParseError = 5, MethodNotFound = 6, Timeout = 7, ResourceExhausted = 8, InternalError = 9, ApplicationErrorBase = 4_096, }
Expand description

REPE high-level error codes.

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

Ok = 0

Success. The response carries a normal result, not an error.

§

VersionMismatch = 1

The request’s REPE version is not supported by this server.

§

InvalidHeader = 2

The fixed header was malformed: bad spec magic, wrong length, or a length that disagrees with the body.

§

InvalidQuery = 3

The query was malformed or used a query format this server does not accept (e.g. a raw-binary query against a JSON-pointer router).

§

InvalidBody = 4

The body could not be interpreted for the target method (wrong shape or type for what the handler expected).

§

ParseError = 5

The message could not be parsed: a framing, header-decode, or body-decode failure below the application level.

§

MethodNotFound = 6

No handler is registered for the requested query path.

§

Timeout = 7

The request did not produce a response within the allotted time.

§

ResourceExhausted = 8

The server is temporarily unable to service the request and the client should retry. Distinct from an application error: it signals transient saturation, not a failed result. The built-in WebSocketServer returns this when an off-reader request is rejected because the per-connection with_offreader_limit cap is reached. Occupies the REPE-reserved 8..4095 range (between Timeout and ApplicationErrorBase).

§

InternalError = 9

The server hit an unexpected internal failure while handling the request; the result is not a normal application-level outcome. The built-in WebSocketServer returns this for a caught off-reader handler panic. Also in the REPE-reserved 8..4095 range.

§

ApplicationErrorBase = 4_096

Base of the application-defined error range. A handler returns this (or any value at or above it) for an ordinary application-level failure, as distinct from the protocol-level codes above and from the ResourceExhausted / InternalError server conditions.

Trait Implementations§

Source§

impl Clone for ErrorCode

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 ErrorCode

Source§

impl Debug for ErrorCode

Source§

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

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

impl Display for ErrorCode

Source§

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

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

impl Eq for ErrorCode

Source§

impl From<ErrorCode> for u32

Source§

fn from(v: ErrorCode) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for ErrorCode

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<'de> Read<'de> for ErrorCode

Source§

fn read<O: Options>(&mut self, p: &mut Parser<'de, O>) -> Result<(), ErrorCode>

Parse into self, from the cursor’s current position. Read more
Source§

impl<'de> Read<'de> for ErrorCode

Source§

fn read<O: Options>(&mut self, r: &mut Reader<'de, O>) -> Result<(), ErrorCode>

Read into self, from the reader’s current position. Read more
Source§

fn read_bulk<O>( _out: &mut Vec<Self>, _n: usize, _elem: u8, _r: &mut Reader<'de, O>, ) -> Result<bool, ErrorCode>
where O: Options,

Fill out from the payload of a typed array of n elements whose element header is elem, or return false to decline. Read more
Source§

impl<'de> ReadEnum<'de> for ErrorCode

Source§

fn read_name<O: Options>( &mut self, index: usize, p: &mut Parser<'de, O>, ) -> Result<bool, ErrorCode>

Take variant index written as a bare name, the cursor sitting on the first byte of it. Read more
Source§

fn read_payload<O: Options>( &mut self, index: usize, p: &mut Parser<'de, O>, ) -> Result<bool, ErrorCode>

Take variant index written as the single key of an object, the cursor sitting on the first byte of that key. Read more
Source§

impl<'de> ReadEnum<'de> for ErrorCode

Source§

fn read_name(&mut self, index: usize, name: &[u8]) -> Result<bool, ErrorCode>

Take variant index written as a bare name. Read more
Source§

fn read_payload<O: Options>( &mut self, index: usize, name: &[u8], r: &mut Reader<'de, O>, ) -> Result<bool, ErrorCode>

Take variant index written as the single member of an object, the reader positioned on that member’s value. Read more
Source§

impl StructuralPartialEq for ErrorCode

Source§

impl TryFrom<u32> for ErrorCode

Source§

type Error = u32

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

fn try_from(value: u32) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Variants for ErrorCode

Source§

const VARIANTS: &'static [&'static str]

Variant names, in declaration order. Index i here is variant i in each format’s read_name and read_payload.
Source§

const MAP: &'static KeyMap

The perfect hash over Variants::VARIANTS, built during const evaluation. Read more
Source§

impl Write for ErrorCode

Source§

fn write<O: Options>(&self, w: &mut Writer<'_, O>)

Source§

fn is_null(&self) -> bool

Whether this value is absent, and so is left out of an object under Options::SKIP_NULL. Read more
Source§

impl Write for ErrorCode

Source§

const ARRAY: Option<&'static [u8]>

The header bytes a contiguous run of this type is stored under, or None if it has no array form of its own and belongs in a generic one. Read more
Source§

fn write<O: Options>(&self, w: &mut Writer<'_, O>)

Source§

fn write_payload<O: Options>(items: &[Self], w: &mut Writer<'_, O>)
where Self: Sized,

Append items as the payload of a typed array whose header and count the caller has already written. Read more
Source§

fn is_null(&self) -> bool

Whether this value is absent, and so is left out of an object under Options::SKIP_NULL. Read more

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> ReadWrite for T
where T: for<'de> Read<'de> + Write,

Source§

impl<T> ReadWrite for T
where T: for<'de> Read<'de> + Write,

Source§

impl<T> ReadWrite for T
where T: ReadWrite + ReadWrite,

Source§

impl<T> Servable for T
where T: for<'de> ServableRead<'de> + ServableWrite,

Source§

impl<'de, T> ServableRead<'de> for T
where T: Read<'de> + Read<'de>,

Source§

impl<T> ServableWrite for T
where T: Write + Write + ?Sized,

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.