#[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
impl ErrorClass
Sourcepub fn from_u8(raw: u8) -> Option<ErrorClass>
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
impl Clone for ErrorClass
Source§fn clone(&self) -> ErrorClass
fn clone(&self) -> ErrorClass
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more