[gnome-maps] printDialog: Add try/catch block around run



commit eb803a1ba44b1b30e5dd695b803ae4d5d668e7eb
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Mon Feb 29 09:20:28 2016 +0100

    printDialog: Add try/catch block around run

 src/printOperation.js |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/src/printOperation.js b/src/printOperation.js
index 422490d..74b38b8 100644
--- a/src/printOperation.js
+++ b/src/printOperation.js
@@ -97,12 +97,15 @@ const PrintOperation = new Lang.Class({
     },
 
     _runPrintOperation: function() {
-        let result = this._operation.run(Gtk.PrintOperationAction.PRINT_DIALOG,
-                                         this._mainWindow, null);
-
-        if (result === Gtk.PrintOperationResult.ERROR) {
-            let error = this._operation.get_error();
-            Utils.debug('Failed to print: %s'.format(error));
+        try {
+            let result = this._operation.run(Gtk.PrintOperationAction.PRINT_DIALOG,
+                                             this._mainWindow, null);
+            if (result === Gtk.PrintOperationResult.ERROR) {
+                let error = this._operation.get_error();
+                Utils.debug('Failed to print: %s'.format(error));
+            }
+        } catch(e) {
+            Utils.debug('Failed to print: %s'.format(e.message));
         }
     }
 });


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