Skip to main content

ErrorCode

Enum ErrorCode 

Source
pub enum ErrorCode {
Show 32 variants RecordNotFound = 1_001, NotUnique = 1_002, InvalidFilter = 1_003, InvalidSelect = 1_004, RequiredFieldMissing = 1_005, UniqueConstraint = 2_001, ForeignKeyConstraint = 2_002, CheckConstraint = 2_003, NotNullConstraint = 2_004, ConnectionFailed = 3_001, PoolExhausted = 3_002, ConnectionTimeout = 3_003, AuthenticationFailed = 3_004, SslError = 3_005, TransactionFailed = 4_001, Deadlock = 4_002, SerializationFailure = 4_003, TransactionClosed = 4_004, QueryTimeout = 5_001, SqlSyntax = 5_002, InvalidParameter = 5_003, QueryTooComplex = 5_004, DatabaseError = 5_005, InvalidDataType = 6_001, SerializationError = 6_002, DeserializationError = 6_003, DataTruncation = 6_004, InvalidConfiguration = 7_001, MissingConfiguration = 7_002, InvalidConnectionString = 7_003, Internal = 9_001, Unknown = 9_999,
}
Expand description

Error codes for programmatic error handling.

Variants§

§

RecordNotFound = 1_001

Record not found (P1001).

§

NotUnique = 1_002

Multiple records found when expecting one (P1002).

§

InvalidFilter = 1_003

Invalid filter or where clause (P1003).

§

InvalidSelect = 1_004

Invalid select or include (P1004).

§

RequiredFieldMissing = 1_005

Required field missing (P1005).

§

UniqueConstraint = 2_001

Unique constraint violation (P2001).

§

ForeignKeyConstraint = 2_002

Foreign key constraint violation (P2002).

§

CheckConstraint = 2_003

Check constraint violation (P2003).

§

NotNullConstraint = 2_004

Not null constraint violation (P2004).

§

ConnectionFailed = 3_001

Database connection failed (P3001).

§

PoolExhausted = 3_002

Connection pool exhausted (P3002).

§

ConnectionTimeout = 3_003

Connection timeout (P3003).

§

AuthenticationFailed = 3_004

Authentication failed (P3004).

§

SslError = 3_005

SSL/TLS error (P3005).

§

TransactionFailed = 4_001

Transaction failed (P4001).

§

Deadlock = 4_002

Deadlock detected (P4002).

§

SerializationFailure = 4_003

Serialization failure (P4003).

§

TransactionClosed = 4_004

Transaction already committed/rolled back (P4004).

§

QueryTimeout = 5_001

Query timeout (P5001).

§

SqlSyntax = 5_002

SQL syntax error (P5002).

§

InvalidParameter = 5_003

Invalid parameter (P5003).

§

QueryTooComplex = 5_004

Query too complex (P5004).

§

DatabaseError = 5_005

General database error (P5005).

§

InvalidDataType = 6_001

Invalid data type (P6001).

§

SerializationError = 6_002

Serialization error (P6002).

§

DeserializationError = 6_003

Deserialization error (P6003).

§

DataTruncation = 6_004

Data truncation (P6004).

§

InvalidConfiguration = 7_001

Invalid configuration (P7001).

§

MissingConfiguration = 7_002

Missing configuration (P7002).

§

InvalidConnectionString = 7_003

Invalid connection string (P7003).

§

Internal = 9_001

Internal error (P9001).

§

Unknown = 9_999

Unknown error (P9999).

Implementations§

Source§

impl ErrorCode

Source

pub fn code(&self) -> String

Get the error code string (e.g., “P1001”).

Source

pub fn description(&self) -> &'static str

Get a short description of the error code.

Source

pub fn docs_url(&self) -> String

Get the documentation URL for this error.

Trait Implementations§

Source§

impl Clone for ErrorCode

Source§

fn clone(&self) -> ErrorCode

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 Hash for ErrorCode

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 PartialEq for ErrorCode

Source§

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

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> 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> ToSmolStr for T
where T: Display + ?Sized,

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