[][src]Trait sqlx::error::DatabaseError

pub trait DatabaseError: 'static + Error + Send + Sync {
    pub fn message(&self) -> &str;

    pub fn code(&self) -> Option<Cow<'_, str>> { ... }
}

An error that was returned from the database.

Required methods

pub fn message(&self) -> &str[src]

The primary, human-readable error message.

Loading content...

Provided methods

pub fn code(&self) -> Option<Cow<'_, str>>[src]

The (SQLSTATE) code for the error.

Loading content...

Implementations

impl dyn DatabaseError + 'static[src]

pub fn downcast_ref<E>(&self) -> &E where
    E: DatabaseError
[src]

Downcast a reference to this generic database error to a specific database error type.

Panics

Panics if the database error type is not E. This is a deliberate contrast from Error::downcast_ref which returns Option<&E>. In normal usage, you should know the specific error type. In other cases, use try_downcast_ref.

pub fn downcast<E>(
    self: Box<dyn DatabaseError + 'static, Global>
) -> Box<E, Global> where
    E: DatabaseError
[src]

Downcast this generic database error to a specific database error type.

Panics

Panics if the database error type is not E. This is a deliberate contrast from Error::downcast which returns Option<E>. In normal usage, you should know the specific error type. In other cases, use try_downcast.

pub fn try_downcast_ref<E>(&self) -> Option<&E> where
    E: DatabaseError
[src]

Downcast a reference to this generic database error to a specific database error type.

pub fn try_downcast<E>(
    self: Box<dyn DatabaseError + 'static, Global>
) -> Result<Box<E, Global>, Box<dyn DatabaseError + 'static, Global>> where
    E: DatabaseError
[src]

Downcast this generic database error to a specific database error type.

Implementors

impl DatabaseError for MssqlDatabaseError[src]

impl DatabaseError for MySqlDatabaseError[src]

impl DatabaseError for PgDatabaseError[src]

impl DatabaseError for SqliteError[src]

pub fn code(&self) -> Option<Cow<'_, str>>[src]

The extended result code.

Loading content...