#[non_exhaustive]pub enum ErrorCode {
Show 14 variants
Other,
NotNullViolation,
ForeignKeyViolation,
UniqueViolation,
CheckViolation,
ExcludeViolation,
TransactionFailed,
DeadlockDetected,
TooManyConnections,
SerializationFailure,
ReadOnlyTransaction,
LockNotAvailable,
QueryCanceled,
ConnectionFailure,
}Expand description
What kind of error a database reported, by its SQLSTATE: the cases an
app most often handles. ErrorCode::Other is any other.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Other
None of the others; the SQLSTATE says what.
NotNullViolation
A NOT NULL constraint would be violated (23502).
ForeignKeyViolation
A foreign key constraint would be violated (23503).
UniqueViolation
A unique constraint would be violated (23505).
CheckViolation
A check constraint would be violated (23514).
ExcludeViolation
An exclusion constraint would be violated (23P01).
TransactionFailed
A statement ran in a transaction an earlier statement failed (25P02).
DeadlockDetected
A deadlock was detected (40P01).
TooManyConnections
The server refused a connection: it has as many as it allows (53300).
SerializationFailure
A serializable or repeatable read transaction could not be serialized with a concurrent one (40001); retrying it may succeed.
ReadOnlyTransaction
A write in a read-only transaction (25006), such as one through a read handle.
LockNotAvailable
A lock could not be taken without waiting (55P03), as with
FOR UPDATE NOWAIT or lock_timeout.
QueryCanceled
The statement was canceled (57014): by a timeout, or on request.
ConnectionFailure
The database could not be reached, or the connection to it 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