[geary/wip/conversation-polish: 18/22] Don't use catch in finally clauses due to Vala bug
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/conversation-polish: 18/22] Don't use catch in finally clauses due to Vala bug
- Date: Tue, 29 Jan 2019 05:39:59 +0000 (UTC)
commit 7f820aa5bbbb7b6439c55f48da373782d4949b61
Author: Michael Gratton <mike vee net>
Date: Thu Jan 24 18:57:38 2019 +1100
Don't use catch in finally clauses due to Vala bug
See https://gitlab.gnome.org/GNOME/vala/issues/742
src/engine/app/app-email-store.vala | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
---
diff --git a/src/engine/app/app-email-store.vala b/src/engine/app/app-email-store.vala
index f7a1a527..7fe1af52 100644
--- a/src/engine/app/app-email-store.vala
+++ b/src/engine/app/app-email-store.vala
@@ -178,25 +178,30 @@ public class Geary.App.EmailStore : BaseObject {
bool open = false;
Gee.Collection<Geary.EmailIdentifier>? used_ids = null;
+ GLib.Error? op_error = null;
try {
yield folder.open_async(Folder.OpenFlags.NONE, cancellable);
open = true;
used_ids = yield operation.execute_async(folder, ids, cancellable);
- } catch (Error e) {
- debug("Error performing an operation on messages in %s: %s", folder.to_string(), e.message);
- } finally {
- if (open) {
- try {
- // Don't use the cancellable here, if it's been
- // opened we need to try to close it.
- yield folder.close_async(null);
- } catch (Error e) {
- debug("Error closing folder %s: %s",
- folder.to_string(), e.message);
- }
+ } catch (GLib.Error err) {
+ op_error = err;
+ }
+
+ if (open) {
+ try {
+ // Don't use the cancellable here, if it's been opened
+ // we need to try to close it.
+ yield folder.close_async(null);
+ } catch (Error e) {
+ warning("Error closing folder %s: %s",
+ folder.to_string(), e.message);
}
}
+ if (op_error != null) {
+ throw op_error;
+ }
+
// We don't want to operate on any mails twice.
if (used_ids != null) {
foreach (Geary.EmailIdentifier id in used_ids.to_array()) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]