Skip to main content

DbError

Enum DbError 

Source
pub enum DbError {
Show 30 variants Parse(String), Semantic(String), Execution(String), Storage(String), Deadlock(String), Custom { class: u8, number: i32, message: String, }, SchemaNotFound { schema: String, }, TableNotFound { schema: String, table: String, }, ColumnNotFound { column: String, }, ColumnNotFoundQualified { table: String, column: String, }, TypeMismatch { expected: String, found: String, }, IndexNotFound { table: String, index: String, }, PrimaryKeyNotFound { table: String, }, ConstraintNotFound { table: String, constraint: String, }, DatabaseNotFound { database: String, }, ObjectNotFound { object: String, }, DuplicateColumn { column: String, }, DuplicateTable { schema: String, table: String, }, InvalidIdentifier { identifier: String, }, TriggerNotFound { schema: String, trigger: String, }, DuplicateTrigger { schema: String, trigger: String, }, ViewNotFound { schema: String, view: String, }, DuplicateView { schema: String, view: String, }, TypeNotFound { schema: String, type_name: String, }, DuplicateType { schema: String, type_name: String, }, DuplicateSchema { schema: String, }, CursorNotDeclared { cursor: String, }, CursorHasNoQuery { cursor: String, }, DivideByZero, ConversionFailed { from_type: String, value: String, to_type: String, },
}

Variants§

§

Parse(String)

§

Semantic(String)

§

Execution(String)

§

Storage(String)

§

Deadlock(String)

§

Custom

A custom error with an explicit SQL Server–style class and number. Allows callers to raise domain-specific errors (e.g. timeout, permission) without modifying the DbError enum itself.

Fields

§class: u8
§number: i32
§message: String
§

SchemaNotFound

Fields

§schema: String
§

TableNotFound

Fields

§schema: String
§table: String
§

ColumnNotFound

Fields

§column: String
§

ColumnNotFoundQualified

Fields

§table: String
§column: String
§

TypeMismatch

Fields

§expected: String
§found: String
§

IndexNotFound

Fields

§table: String
§index: String
§

PrimaryKeyNotFound

Fields

§table: String
§

ConstraintNotFound

Fields

§table: String
§constraint: String
§

DatabaseNotFound

Fields

§database: String
§

ObjectNotFound

Fields

§object: String
§

DuplicateColumn

Fields

§column: String
§

DuplicateTable

Fields

§schema: String
§table: String
§

InvalidIdentifier

Fields

§identifier: String
§

TriggerNotFound

Fields

§schema: String
§trigger: String
§

DuplicateTrigger

Fields

§schema: String
§trigger: String
§

ViewNotFound

Fields

§schema: String
§view: String
§

DuplicateView

Fields

§schema: String
§view: String
§

TypeNotFound

Fields

§schema: String
§type_name: String
§

DuplicateType

Fields

§schema: String
§type_name: String
§

DuplicateSchema

Fields

§schema: String
§

CursorNotDeclared

Fields

§cursor: String
§

CursorHasNoQuery

Fields

§cursor: String
§

DivideByZero

§

ConversionFailed

Fields

§from_type: String
§value: String
§to_type: String

Implementations§

Source§

impl DbError

Source

pub fn class(&self) -> ErrorClass

Source

pub fn class_severity(&self) -> u8

Source

pub fn number(&self) -> i32

Source

pub fn code(&self) -> &'static str

Source

pub fn schema_not_found(schema: impl Into<String>) -> Self

Source

pub fn table_not_found( schema: impl Into<String>, table: impl Into<String>, ) -> Self

Source

pub fn column_not_found(column: impl Into<String>) -> Self

Source

pub fn column_not_found_qualified( table: impl Into<String>, column: impl Into<String>, ) -> Self

Source

pub fn type_mismatch( expected: impl Into<String>, found: impl Into<String>, ) -> Self

Source

pub fn index_not_found( table: impl Into<String>, index: impl Into<String>, ) -> Self

Source

pub fn primary_key_not_found(table: impl Into<String>) -> Self

Source

pub fn constraint_not_found( table: impl Into<String>, constraint: impl Into<String>, ) -> Self

Source

pub fn database_not_found(database: impl Into<String>) -> Self

Source

pub fn object_not_found(object: impl Into<String>) -> Self

Source

pub fn duplicate_column(column: impl Into<String>) -> Self

Source

pub fn duplicate_table( schema: impl Into<String>, table: impl Into<String>, ) -> Self

Source

pub fn invalid_identifier(identifier: impl Into<String>) -> Self

Source

pub fn trigger_not_found( schema: impl Into<String>, trigger: impl Into<String>, ) -> Self

Source

pub fn duplicate_trigger( schema: impl Into<String>, trigger: impl Into<String>, ) -> Self

Source

pub fn view_not_found( schema: impl Into<String>, view: impl Into<String>, ) -> Self

Source

pub fn duplicate_view( schema: impl Into<String>, view: impl Into<String>, ) -> Self

Source

pub fn type_not_found( schema: impl Into<String>, type_name: impl Into<String>, ) -> Self

Source

pub fn duplicate_type( schema: impl Into<String>, type_name: impl Into<String>, ) -> Self

Source

pub fn duplicate_schema(schema: impl Into<String>) -> Self

Source

pub fn cursor_not_declared(cursor: impl Into<String>) -> Self

Source

pub fn cursor_has_no_query(cursor: impl Into<String>) -> Self

Source

pub fn divide_by_zero() -> Self

Source

pub fn conversion_failed( from_type: impl Into<String>, value: impl Into<String>, to_type: impl Into<String>, ) -> Self

Trait Implementations§

Source§

impl Clone for DbError

Source§

fn clone(&self) -> DbError

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DbError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for DbError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for DbError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.