1use std::fmt;
4
5#[derive(Debug, Clone)]
10pub struct AqlError(String);
11
12impl AqlError {
13 pub fn new(msg: impl fmt::Display) -> Self {
15 Self(msg.to_string())
16 }
17
18 pub fn message(&self) -> &str {
20 &self.0
21 }
22}
23
24impl fmt::Display for AqlError {
25 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
26 f.write_str(&self.0)
27 }
28}
29
30impl std::error::Error for AqlError {}
31
32impl From<String> for AqlError {
33 fn from(s: String) -> Self {
34 Self(s)
35 }
36}
37
38impl From<&str> for AqlError {
39 fn from(s: &str) -> Self {
40 Self(s.to_owned())
41 }
42}