mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:47:47 +00:00
LibIMAP+Mail+test-imap: Let a Promise result type be non-optional
The Empty type was used only when parsing a response failed. The failures will now go to Promise's error type.
This commit is contained in:
parent
1f605407bd
commit
90af21aef4
4 changed files with 71 additions and 72 deletions
|
@ -137,7 +137,7 @@ ErrorOr<bool> MailWidget::connect_and_login()
|
|||
|
||||
m_statusbar->set_text(String::formatted("Connected. Logging in as {}...", username).release_value_but_fixme_should_propagate_errors());
|
||||
|
||||
auto response = TRY(m_imap_client->login(username, password)->await()).release_value();
|
||||
auto response = TRY(m_imap_client->login(username, password)->await());
|
||||
|
||||
if (response.status() != IMAP::ResponseStatus::OK) {
|
||||
dbgln("Failed to login. The server says: '{}'", response.response_text());
|
||||
|
@ -147,7 +147,7 @@ ErrorOr<bool> MailWidget::connect_and_login()
|
|||
}
|
||||
|
||||
m_statusbar->set_text("Logged in. Loading mailboxes..."_string);
|
||||
response = TRY(m_imap_client->list(""sv, "*"sv)->await()).release_value();
|
||||
response = TRY(m_imap_client->list(""sv, "*"sv)->await());
|
||||
|
||||
if (response.status() != IMAP::ResponseStatus::OK) {
|
||||
dbgln("Failed to retrieve mailboxes. The server says: '{}'", response.response_text());
|
||||
|
@ -174,7 +174,7 @@ void MailWidget::on_window_close()
|
|||
// User closed main window before a connection was established
|
||||
return;
|
||||
}
|
||||
auto response = move(MUST(m_imap_client->send_simple_command(IMAP::CommandType::Logout)->await()).release_value().get<IMAP::SolidResponse>());
|
||||
auto response = move(MUST(m_imap_client->send_simple_command(IMAP::CommandType::Logout)->await()).get<IMAP::SolidResponse>());
|
||||
VERIFY(response.status() == IMAP::ResponseStatus::OK);
|
||||
|
||||
m_imap_client->close();
|
||||
|
@ -265,7 +265,7 @@ void MailWidget::selected_mailbox()
|
|||
if (mailbox.flags & (unsigned)IMAP::MailboxFlag::NoSelect)
|
||||
return;
|
||||
|
||||
auto response = MUST(m_imap_client->select(mailbox.name)->await()).release_value();
|
||||
auto response = MUST(m_imap_client->select(mailbox.name)->await());
|
||||
|
||||
if (response.status() != IMAP::ResponseStatus::OK) {
|
||||
dbgln("Failed to select mailbox. The server says: '{}'", response.response_text());
|
||||
|
@ -297,7 +297,7 @@ void MailWidget::selected_mailbox()
|
|||
},
|
||||
};
|
||||
|
||||
auto fetch_response = MUST(m_imap_client->fetch(fetch_command, false)->await()).release_value();
|
||||
auto fetch_response = MUST(m_imap_client->fetch(fetch_command, false)->await());
|
||||
if (fetch_response.status() != IMAP::ResponseStatus::OK) {
|
||||
dbgln("Failed to retrieve subject/from for e-mails. The server says: '{}'", response.response_text());
|
||||
m_statusbar->set_text(String::formatted("[{}]: Failed to fetch messages :^(", mailbox.name).release_value_but_fixme_should_propagate_errors());
|
||||
|
@ -452,7 +452,7 @@ void MailWidget::selected_email_to_load()
|
|||
},
|
||||
};
|
||||
|
||||
auto fetch_response = MUST(m_imap_client->fetch(fetch_command, false)->await()).release_value();
|
||||
auto fetch_response = MUST(m_imap_client->fetch(fetch_command, false)->await());
|
||||
|
||||
if (fetch_response.status() != IMAP::ResponseStatus::OK) {
|
||||
dbgln("Failed to retrieve the body structure of the selected e-mail. The server says: '{}'", fetch_response.response_text());
|
||||
|
@ -516,7 +516,7 @@ void MailWidget::selected_email_to_load()
|
|||
},
|
||||
};
|
||||
|
||||
fetch_response = MUST(m_imap_client->fetch(fetch_command, false)->await()).release_value();
|
||||
fetch_response = MUST(m_imap_client->fetch(fetch_command, false)->await());
|
||||
|
||||
if (fetch_response.status() != IMAP::ResponseStatus::OK) {
|
||||
dbgln("Failed to retrieve the body of the selected e-mail. The server says: '{}'", fetch_response.response_text());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue