From a3fcdf263d2648d010d1f1f1ad14d5d067a33201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Cruz?= Date: Thu, 22 Sep 2022 15:30:04 +0100 Subject: [PATCH] fix(transport): return whole smtp error string (#821) We were only returning the first line of the error message, but that may not be enough to get the whole context of the error. Since we have already parsed the response, just return the whole error to the user. Related to #694 --- src/transport/smtp/client/async_connection.rs | 2 +- src/transport/smtp/client/connection.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/transport/smtp/client/async_connection.rs b/src/transport/smtp/client/async_connection.rs index 3f525e7..2aeaa19 100644 --- a/src/transport/smtp/client/async_connection.rs +++ b/src/transport/smtp/client/async_connection.rs @@ -317,7 +317,7 @@ impl AsyncSmtpConnection { } else { Err(error::code( response.code(), - response.first_line().map(|s| s.to_owned()), + Some(response.message().collect()), )) } } diff --git a/src/transport/smtp/client/connection.rs b/src/transport/smtp/client/connection.rs index 657cb94..a72e646 100644 --- a/src/transport/smtp/client/connection.rs +++ b/src/transport/smtp/client/connection.rs @@ -285,7 +285,7 @@ impl SmtpConnection { } else { Err(error::code( response.code(), - response.first_line().map(|s| s.to_owned()), + Some(response.message().collect()), )) }; }