pub enum Error {
Postgres(Error),
Pool(PoolError),
Build(BuildError),
WireLength(TryFromSliceError),
Utf8(Utf8Error),
Json(Error),
UnknownTypeOid {
oid: u32,
},
Other(Box<dyn Error + Send + Sync>),
}Variants§
Postgres(Error)
Pool(PoolError)
Build(BuildError)
WireLength(TryFromSliceError)
A wire-format buffer was the wrong length for the type being decoded (malformed or truncated data).
Utf8(Utf8Error)
A text/varchar/bpchar field’s bytes weren’t valid UTF-8.
Json(Error)
A jsonb field’s bytes weren’t valid JSON, or a DecodedValue::Object
being bound as a jsonb parameter failed to serialize.
UnknownTypeOid
A result column came back with a type OID this decoder has no rule for and that connect-time discovery didn’t classify either. Returned rather than guessed at: the fallback that used to stand in here (decode the raw binary as UTF-8 text) is only correct for text-like types, and silently produced mojibake for everything else.
Other(Box<dyn Error + Send + Sync>)
Everything else: DSN parse failures, the “cannot bind a composite as a query parameter” case — none of these originate from a real Postgres response, so none of them carry a SQLSTATE.
Implementations§
Source§impl Error
impl Error
Sourcepub fn sqlstate(&self) -> Option<&SqlState>
pub fn sqlstate(&self) -> Option<&SqlState>
The Postgres SQLSTATE code, when this error is a real response from the server (as opposed to a connection/pool/decode failure, none of which have one) — the single source of truth error mapping at the pyo3 boundary classifies on.
Sourcepub fn pg_message(&self) -> String
pub fn pg_message(&self) -> String
The message a caller should actually show. tokio_postgres::Error’s
own Display only renders a generic category string for a
server-side error ("db error" for every DbError-backed failure,
regardless of what the server actually said) — the real detail
(e.g. duplicate key value violates unique constraint "...") lives
one level deeper, in the DbError its source() wraps, so this
prefers that when present and falls back to Display otherwise.
Sourcepub fn violated_scalar(&self) -> Option<(&str, &str)>
pub fn violated_scalar(&self) -> Option<(&str, &str)>
(schema, type name) for the PostgreSQL scalar/domain a
CHECK_VIOLATION failed against (Postgres’s SchemaName/
DataTypeName error fields — both populated for a domain check,
confirmed live) — Some(("public", "Email")) for a registered
custom scalar’s own DOMAIN check; None for an ordinary
table-level CHECK (use violated_table instead).
Sourcepub fn violated_table(&self) -> Option<(&str, &str)>
pub fn violated_table(&self) -> Option<(&str, &str)>
(schema, table) a CHECK_VIOLATION’s table-level constraint
belongs to, when Postgres reports one (a domain-level check
reports violated_datatype instead, not this).
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<BuildError> for Error
impl From<BuildError> for Error
Source§fn from(source: BuildError) -> Self
fn from(source: BuildError) -> Self
Source§impl From<TryFromSliceError> for Error
impl From<TryFromSliceError> for Error
Source§fn from(source: TryFromSliceError) -> Self
fn from(source: TryFromSliceError) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for Error
impl !UnwindSafe for Error
impl Freeze for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
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> 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.