pub enum ConnectorError {
Database(SqlxErrorKind, String),
Connection(SqlxErrorKind, String),
RowDecode(SqlxErrorKind, String),
Core(Error),
}Expand description
Error type for database connector operations.
This covers everything that can go wrong at runtime when talking to a
database. Query-building errors are represented by nautilus_core::Error
and can be wrapped via the ConnectorError::Core variant.
Each variant that originates from a sqlx error carries a SqlxErrorKind
discriminant for programmatic inspection (e.g. constraint violations vs I/O
errors) without storing the non-Clone sqlx::Error itself.
Variants§
Database(SqlxErrorKind, String)
A query was executed successfully but the database returned an error.
Connection(SqlxErrorKind, String)
Could not establish or acquire a database connection.
RowDecode(SqlxErrorKind, String)
A row could not be decoded into the expected Rust types.
Core(Error)
A query-building error originating from nautilus-core.
Implementations§
Source§impl ConnectorError
impl ConnectorError
Sourcepub fn database(e: Error, context: &str) -> Self
pub fn database(e: Error, context: &str) -> Self
Create a Database error from a sqlx error with a context message.
Sourcepub fn connection(e: Error, context: &str) -> Self
pub fn connection(e: Error, context: &str) -> Self
Create a Connection error from a sqlx error with a context message.
Sourcepub fn row_decode(e: Error, context: &str) -> Self
pub fn row_decode(e: Error, context: &str) -> Self
Create a RowDecode error from a sqlx error with a context message.
Sourcepub fn database_msg(msg: impl Into<String>) -> Self
pub fn database_msg(msg: impl Into<String>) -> Self
Create a Database error from a plain message (no sqlx source).
Sourcepub fn connection_msg(msg: impl Into<String>) -> Self
pub fn connection_msg(msg: impl Into<String>) -> Self
Create a Connection error from a plain message (no sqlx source).
Sourcepub fn row_decode_msg(msg: impl Into<String>) -> Self
pub fn row_decode_msg(msg: impl Into<String>) -> Self
Create a RowDecode error from a plain message (no sqlx source).
Sourcepub fn sqlx_kind(&self) -> SqlxErrorKind
pub fn sqlx_kind(&self) -> SqlxErrorKind
Returns the SqlxErrorKind for this error, if applicable.
Trait Implementations§
Source§impl Clone for ConnectorError
impl Clone for ConnectorError
Source§fn clone(&self) -> ConnectorError
fn clone(&self) -> ConnectorError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ConnectorError
impl Debug for ConnectorError
Source§impl Display for ConnectorError
impl Display for ConnectorError
Source§impl Error for ConnectorError
impl Error for ConnectorError
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<Error> for ConnectorError
impl From<Error> for ConnectorError
Source§impl PartialEq for ConnectorError
impl PartialEq for ConnectorError
Source§fn eq(&self, other: &ConnectorError) -> bool
fn eq(&self, other: &ConnectorError) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ConnectorError
Auto Trait Implementations§
impl Freeze for ConnectorError
impl RefUnwindSafe for ConnectorError
impl Send for ConnectorError
impl Sync for ConnectorError
impl Unpin for ConnectorError
impl UnsafeUnpin for ConnectorError
impl UnwindSafe for ConnectorError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more