1use sqlx::error::Error as SqlxError;
2use std::{error::Error as StdError, fmt};
3
4#[derive(Debug)]
5pub enum Error {
6 SqlxError(SqlxError),
7}
8
9impl fmt::Display for Error {
10 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
11 use Error::*;
12
13 match self {
14 SqlxError(sqlx_error) => sqlx_error.fmt(f),
15 }
16 }
17}
18
19impl StdError for Error {
20 fn source(&self) -> Option<&(dyn StdError + 'static)> {
21 use Error::*;
22
23 match self {
24 SqlxError(sqlx_err) => Some(sqlx_err),
25 }
26 }
27}
28
29impl From<SqlxError> for Error {
30 fn from(err: SqlxError) -> Self {
31 Error::SqlxError(err)
32 }
33}