#[non_exhaustive]pub enum ErrorCode {
Show 14 variants
Other,
NotNullViolation,
ForeignKeyViolation,
UniqueViolation,
CheckViolation,
ExcludeViolation,
TransactionFailed,
DeadlockDetected,
TooManyConnections,
SerializationFailure,
ReadOnlyTransaction,
LockNotAvailable,
QueryCanceled,
ConnectionFailure,
}Expand description
Categorized Postgres error codes derived from SQLSTATE for common
application-handled errors. Unmapped SQLSTATE values use ErrorCode::Other.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Other
Any other SQLSTATE not covered by the variants below.
NotNullViolation
A NOT NULL constraint was violated (23502).
ForeignKeyViolation
A foreign key constraint was violated (23503).
UniqueViolation
A unique constraint was violated (23505).
CheckViolation
A check constraint was violated (23514).
ExcludeViolation
An exclusion constraint was violated (23P01).
TransactionFailed
A statement ran in a transaction that was already aborted by an earlier
error (25P02).
DeadlockDetected
A deadlock was detected (40P01).
TooManyConnections
The server rejected the connection because its connection limit was
reached (53300).
SerializationFailure
A SERIALIZABLE or REPEATABLE READ transaction conflicted with a
concurrent transaction (40001); retrying may succeed.
ReadOnlyTransaction
A write was attempted in a read-only transaction (25006), such as on
a read handle.
LockNotAvailable
A lock could not be acquired without waiting (55P03), such as with
FOR UPDATE NOWAIT or lock_timeout.
QueryCanceled
The statement was canceled (57014), either by a timeout or explicitly.
ConnectionFailure
The database could not be reached or the connection was lost (class 08).
Implementations§
Source§impl ErrorCode
impl ErrorCode
Sourcepub fn from_sqlstate(sqlstate: &str) -> ErrorCode
pub fn from_sqlstate(sqlstate: &str) -> ErrorCode
The code of SQLSTATE sqlstate; ErrorCode::Other for one not in
the table. See
https://www.postgresql.org/docs/current/errcodes-appendix.html.
Trait Implementations§
impl Copy for ErrorCode
impl Eq for ErrorCode
impl StructuralPartialEq for ErrorCode
Auto Trait Implementations§
impl Forget for ErrorCode
impl Freeze for ErrorCode
impl Move for ErrorCode
impl RefUnwindSafe for ErrorCode
impl Send for ErrorCode
impl Sync for ErrorCode
impl Unpin for ErrorCode
impl UnsafeUnpin for ErrorCode
impl UnwindSafe for ErrorCode
Blanket Implementations§
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request