[polari] Stop using conditional catch statements



commit eeac87291a78c5b19ffd7e974b8a37b7986d1f3d
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Jul 7 11:17:58 2018 +0200

    Stop using conditional catch statements
    
    It is a mozilla extension that is going away in SpiderMonkey 60.
    
    https://gitlab.gnome.org/GNOME/polari/merge_requests/47

 src/application.js | 12 ++++++++----
 src/mainWindow.js  |  6 ++++--
 2 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 300d099..5564fea 100644
--- a/src/application.js
+++ b/src/application.js
@@ -463,8 +463,10 @@ var Application = GObject.registerClass({
     _touchFile(file) {
         try {
             file.get_parent().make_directory_with_parents(null);
-        } catch(e if e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.EXISTS)) {
-            // not an error, carry on
+        } catch(e) {
+            if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.EXISTS))
+                return; // not an error, carry on
+            throw e;
         }
 
         let stream = file.create(0, null);
@@ -734,8 +736,10 @@ var Application = GObject.registerClass({
     _createLink(file, target) {
         try {
             file.get_parent().make_directory_with_parents(null);
-        } catch(e if e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.EXISTS)) {
-            // not an error, carry on
+        } catch(e) {
+            if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.EXISTS))
+                return; // not an error, carry on
+            throw e;
         }
 
         file.make_symbolic_link(target, null);
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 10ec5b9..5245f9a 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -252,8 +252,10 @@ var MainWindow = GObject.registerClass({
     _touchFile(file) {
         try {
             file.get_parent().make_directory_with_parents(null);
-        } catch(e if e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.EXISTS)) {
-            // not an error, carry on
+        } catch(e) {
+            if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.EXISTS))
+                return; // not an error, carry on
+            throw e;
         }
 
         let stream = file.create(0, null);


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