Skip to content

Instantly share code, notes, and snippets.

@hpk42
Created December 16, 2019 12:05
Show Gist options
  • Save hpk42/fc05e23bb6dce753cd80b195d0763d78 to your computer and use it in GitHub Desktop.
Save hpk42/fc05e23bb6dce753cd80b195d0763d78 to your computer and use it in GitHub Desktop.
diff --git a/src/imap_client.rs b/src/imap_client.rs
index 3f4da0d..04f8eff 100644
--- a/src/imap_client.rs
+++ b/src/imap_client.rs
@@ -43,10 +43,9 @@ impl Client {
client.debug = true;
}
- let _greeting = client
- .read_response()
- .await
- .expect("failed to read greeting");
+ if client.read_response().await.is_none() {
+ return Err(ImapError::Bad("failed to read greeting".to_string()));
+ }
Ok(Client::Secure(client))
}
@@ -58,10 +57,10 @@ impl Client {
if std::env::var(crate::DCC_IMAP_DEBUG).is_ok() {
client.debug = true;
}
- let _greeting = client
- .read_response()
- .await
- .expect("failed to read greeting");
+
+ if client.read_response().await.is_none() {
+ return Err(ImapError::Bad("failed to read greeting".to_string()));
+ }
Ok(Client::Insecure(client))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment