wechat_error/convert/
for_lettre.rs1use crate::{AliError, AliErrorKind};
2use lettre::{address::AddressError, error::Error};
3
4impl From<lettre::transport::smtp::Error> for AliError {
5 fn from(value: lettre::transport::smtp::Error) -> Self {
6 let kind = AliErrorKind::NetworkError { message: value.to_string() };
7 Self { kind: Box::new(kind) }
8 }
9}
10
11impl From<Error> for AliError {
12 fn from(value: Error) -> Self {
13 let kind = AliErrorKind::ServiceError { message: value.to_string() };
14 Self { kind: Box::new(kind) }
15 }
16}
17impl From<AddressError> for AliError {
18 fn from(value: AddressError) -> Self {
19 let kind = AliErrorKind::DecoderError { format: "email".to_string(), message: value.to_string() };
20 Self { kind: Box::new(kind) }
21 }
22}