#[non_exhaustive]pub enum Error {
Show 14 variants
Connection(String),
ConnectionWithSource {
msg: String,
source: Source,
},
Authentication,
Query(String),
QueryWithSource {
msg: String,
source: Source,
},
UnknownDriver(String),
UnsupportedType(String),
Unsupported(String),
Schema(String),
Config(String),
ConfigWithSource {
msg: String,
source: Source,
},
Cancelled,
Io(Error),
Other(String),
}Expand description
Error returned from the core abstractions and from driver implementations.
M1: each high-level variant now has a *WithSource sibling that
preserves the underlying driver error via thiserror’s #[source]
chain. Callers that need to discriminate driver-specific conditions
(e.g. tokio_postgres::Error::is_closed()) can downcast via
std::error::Error::source() and Any::downcast_ref without
requiring narwhal-core to depend on every driver crate.
The string-only variants are retained for backwards compatibility
with drivers that don’t yet carry the source through; both render
identically via Display, so log lines and user-facing messages
are unchanged.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Connection(String)
ConnectionWithSource
Authentication
Query(String)
QueryWithSource
UnknownDriver(String)
UnsupportedType(String)
Unsupported(String)
Schema(String)
Config(String)
ConfigWithSource
Cancelled
Io(Error)
Other(String)
Implementations§
Source§impl Error
impl Error
pub fn other(msg: impl Into<String>) -> Self
pub fn unsupported(msg: impl Into<String>) -> Self
Sourcepub fn connection_with(
msg: impl Into<String>,
source: impl Into<Source>,
) -> Self
pub fn connection_with( msg: impl Into<String>, source: impl Into<Source>, ) -> Self
Build a connection error that preserves the underlying driver
error in the source() chain.
Sourcepub fn query_with(msg: impl Into<String>, source: impl Into<Source>) -> Self
pub fn query_with(msg: impl Into<String>, source: impl Into<Source>) -> Self
Build a query error that preserves the underlying driver error
in the source() chain.
Sourcepub fn config_with(msg: impl Into<String>, source: impl Into<Source>) -> Self
pub fn config_with(msg: impl Into<String>, source: impl Into<Source>) -> Self
Build a configuration error that preserves the underlying parse
/ validation error in the source() chain.
Sourcepub fn find_source<T: Error + 'static>(&self) -> Option<&T>
pub fn find_source<T: Error + 'static>(&self) -> Option<&T>
Walk the std::error::Error::source() chain looking for a
concrete driver error type. Convenience wrapper around the
repeated downcast pattern.
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()