Skip to main content

ErrorClass

Enum ErrorClass 

Source
#[repr(u8)]
pub enum ErrorClass { Internal = 0, Parse = 1, Execution = 2, Timeout = 3, LimitExceeded = 4, ReadonlyRefused = 5, AuthFailed = 6, RateLimited = 7, ConstraintViolation = 8, Cancelled = 9, }
Expand description

Stable 1-byte error classification carried at the tail of a MSG_ERROR payload.

Wire contract: the MSG_ERROR payload is a length-prefixed message string, optionally followed by exactly one trailing class byte. Every first-party decoder (this module, the TS client, the CLI via this module) reads the string by its length prefix and ignores trailing payload bytes, so:

  • old client + new server: the class byte is silently skipped,
  • new client + old server: the byte is absent and decodes as “no class”.

The class is orthogonal to message sanitization: it is safe metadata even when the message text is masked to a generic string.

STABILITY: these numeric values are wire-stable and documented in docs/errors.md. Never renumber or reuse a value; only append new classes. Clients must treat unknown values as ErrorClass::Internal.

Variants§

§

Internal = 0

Unclassified or internal server error (also the fallback for values a client does not recognize).

§

Parse = 1

The query text failed to lex or parse.

§

Execution = 2

Planning or execution failed (unknown table or column, type mismatch, unsupported statement, …).

§

Timeout = 3

A time budget elapsed: per-query timeout, transaction-gate wait, cooperative deadline cancellation, or idle-connection timeout.

§

LimitExceeded = 4

A memory or size limit was exceeded (sort/join row caps, per-query memory budget, oversized query text, oversized result).

§

ReadonlyRefused = 5

The server serves a read-only snapshot and the statement requires a writer.

§

AuthFailed = 6

Authentication or database selection failed at CONNECT time.

§

RateLimited = 7

Too many failed authentication attempts from this address.

§

ConstraintViolation = 8

A constraint (e.g. a unique index) rejected the write.

§

Cancelled = 9

Execution was cancelled cooperatively (client disconnect).

Implementations§

Source§

impl ErrorClass

Source

pub fn as_u8(self) -> u8

The stable wire byte for this class.

Source

pub fn from_u8(raw: u8) -> Option<ErrorClass>

Parse a wire byte back into a class. Unknown (future) values return None; callers should treat them as ErrorClass::Internal.

Trait Implementations§

Source§

impl Clone for ErrorClass

Source§

fn clone(&self) -> ErrorClass

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 ErrorClass

Source§

impl Debug for ErrorClass

Source§

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

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

impl Eq for ErrorClass

Source§

impl PartialEq for ErrorClass

Source§

fn eq(&self, other: &ErrorClass) -> 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 ErrorClass

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> 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> Same for T

Source§

type Output = T

Should always be Self
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