pub enum ErrorClass {
ConstraintViolation,
Contention,
Timeout,
Connection,
Compile,
Other,
}Expand description
A coarse bucket for a failed query, for use as a metric label.
Deliberately coarse: an unbounded label (a raw error message, a SQLSTATE, a constraint name) is exactly the thing that blows up a metrics backend’s cardinality. Anything finer belongs on a span or in a log line.
Variants§
ConstraintViolation
A constraint the write violated — unique, foreign key, check, not-null.
Contention
Serialization failure or deadlock: the caller can retry.
Timeout
Statement or lock timeout.
Connection
Couldn’t reach or stay connected to the database.
Compile
The query never reached the database — bad PyQL, unknown type/pointer.
Other
Implementations§
Source§impl ErrorClass
impl ErrorClass
Sourcepub fn as_label(self) -> &'static str
pub fn as_label(self) -> &'static str
The label value. &'static str so it can’t accidentally become
unbounded.
Sourcepub fn from_sqlstate(code: &str) -> Self
pub fn from_sqlstate(code: &str) -> Self
Buckets a SQLSTATE by its two-character class, which is how the
standard already groups them — so a code this was never written
against still lands somewhere sensible instead of in Other.
Trait Implementations§
Source§impl Clone for ErrorClass
impl Clone for ErrorClass
impl Copy for ErrorClass
Source§impl Debug for ErrorClass
impl Debug for ErrorClass
impl Eq for ErrorClass
Source§impl PartialEq for ErrorClass
impl PartialEq for ErrorClass
impl StructuralPartialEq for ErrorClass
Auto Trait Implementations§
impl Freeze for ErrorClass
impl RefUnwindSafe for ErrorClass
impl Send for ErrorClass
impl Sync for ErrorClass
impl Unpin for ErrorClass
impl UnsafeUnpin for ErrorClass
impl UnwindSafe for ErrorClass
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.