Forward first line of response for negative responses (#701)
This commit is contained in:
@@ -295,7 +295,10 @@ impl AsyncSmtpConnection {
|
||||
return if response.is_positive() {
|
||||
Ok(response)
|
||||
} else {
|
||||
Err(error::code(response.code()))
|
||||
Err(error::code(
|
||||
response.code(),
|
||||
response.first_line().map(|s| s.to_owned()),
|
||||
))
|
||||
}
|
||||
}
|
||||
Err(nom::Err::Failure(e)) => {
|
||||
|
||||
@@ -276,7 +276,10 @@ impl SmtpConnection {
|
||||
return if response.is_positive() {
|
||||
Ok(response)
|
||||
} else {
|
||||
Err(error::code(response.code()))
|
||||
Err(error::code(
|
||||
response.code(),
|
||||
response.first_line().map(|s| s.to_owned()),
|
||||
))
|
||||
};
|
||||
}
|
||||
Err(nom::Err::Failure(e)) => {
|
||||
|
||||
@@ -154,10 +154,10 @@ impl StdError for Error {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn code(c: Code) -> Error {
|
||||
pub(crate) fn code(c: Code, s: Option<String>) -> Error {
|
||||
match c.severity {
|
||||
Severity::TransientNegativeCompletion => Error::new::<Error>(Kind::Transient(c), None),
|
||||
Severity::PermanentNegativeCompletion => Error::new::<Error>(Kind::Permanent(c), None),
|
||||
Severity::TransientNegativeCompletion => Error::new(Kind::Transient(c), s),
|
||||
Severity::PermanentNegativeCompletion => Error::new(Kind::Permanent(c), s),
|
||||
_ => client("Unknown error code"),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user