sqlx/src/mariadb/error.rs
2019-11-19 19:55:17 +00:00

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: {}",)
}
}