[geary/mjog/email-templates: 64/72] Application.MainWindow: Email not found error when discarding a draft



commit 1742a085f375e721857cca8f1895647467bffb01
Author: Michael Gratton <mike vee net>
Date:   Mon Apr 20 11:18:35 2020 +1000

    Application.MainWindow: Email not found error when discarding a draft
    
    When the drafts folder is selected, and a draft is being edited, and
    that dis discarded, there is a race between the composer disappearing
    (and hence the draft being shown again) and the draft itself being
    removed from the folder. Attempt to check for this and avoid reporting
    the problem.

 src/client/application/application-main-window.vala | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
---
diff --git a/src/client/application/application-main-window.vala 
b/src/client/application/application-main-window.vala
index f0e59800..e6e91cf3 100644
--- a/src/client/application/application-main-window.vala
+++ b/src/client/application/application-main-window.vala
@@ -1466,6 +1466,22 @@ public class Application.MainWindow :
                             context.contacts,
                             start_mark_timer
                         );
+                    } catch (Geary.EngineError.NOT_FOUND err) {
+                        // The first interesting email from the
+                        // conversation wasn't found. If the
+                        // conversation has completely evaporated by
+                        // now then fine, otherwise throw the
+                        // error. This happens e.g. in the drafts
+                        // folder, there is a race between the
+                        // composer being discarded and the draft
+                        // itself disappearing
+                        if (convo.get_count() == 0) {
+                            debug("Ignoring not found error: %s", err.message);
+                        } else {
+                            handle_error(
+                                convo.base_folder.account.information, err
+                            );
+                        }
                     } catch (GLib.IOError.CANCELLED err) {
                         // All good
                     } catch (GLib.Error err) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]