mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-03 07:45:30 +00:00
22 lines
419 B
Rust
22 lines
419 B
Rust
use crate::{error::DatabaseError, mariadb::protocol::ErrorCode};
|
|
|
|
use std::fmt;
|
|
|
|
#[derive(Debug)]
|
|
pub struct Error {
|
|
pub code: ErrorCode,
|
|
pub message: Box<str>,
|
|
}
|
|
|
|
impl DatabaseError for Error {
|
|
fn message(&self) -> &str {
|
|
&self.message
|
|
}
|
|
}
|
|
|
|
impl fmt::Display for ErrorCode {
|
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
write!(f, "MariaDB returned an error: {}",)
|
|
}
|
|
}
|