easy_sqlx_core/sql/error.rs
1use std::fmt::Display;
2
3#[derive(Debug, Clone)]
4pub struct Error(pub String);
5
6impl Error {
7 pub fn new(msg: &str) -> Self {
8 Self(msg.to_string())
9 }
10}
11
12impl Display for Error {
13 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14 write!(f, "{}", self.0)
15 }
16}
17
18// impl From<std::io::Error> for StrError {
19// fn from(err: std::io::Error) -> Self {
20// Self {
21// message: err.to_string().as_str(),
22// }
23// }
24// }
25
26impl std::error::Error for Error {}