[Pkg-mozext-commits] [tabmixplus] 56/73: Fix Webstorm inspection errors - Using throw statements as a "goto" to change the local flow of control is likely to be confusing

David Prévot taffit at moszumanska.debian.org
Mon May 9 02:30:56 UTC 2016


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository tabmixplus.

commit 36cf0b9494844c0267bbd5e7cd2aca9aab5ec505
Author: onemen <tabmix.onemen at gmail.com>
Date:   Wed Apr 20 19:09:55 2016 +0300

    Fix Webstorm inspection errors - Using throw statements as a "goto" to change the local flow of control is likely to be confusing
---
 modules/DynamicRules.jsm | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/modules/DynamicRules.jsm b/modules/DynamicRules.jsm
index ff74a11..5b2d4f9 100644
--- a/modules/DynamicRules.jsm
+++ b/modules/DynamicRules.jsm
@@ -365,16 +365,20 @@ this.DynamicRules = {
 
     var currentPrefValues, prefValues = {};
     let prefString = Prefs.getCharPref(ruleName);
-    try {
-      currentPrefValues = TabmixSvc.JSON.parse(prefString);
-      if (currentPrefValues === null)
-        throw Error(ruleName + " value is invalid\n" + prefString);
-    } catch (ex) {
+    let handleError = function(ex) {
       TabmixSvc.console.log(ex);
       TabmixSvc.console.log('Error in preference "' + ruleName + '", value was reset to default');
       Prefs.clearUserPref(ruleName);
       // set prev value to default so we can continue with this function
       currentPrefValues = defaultPrefValues;
+    };
+    try {
+      currentPrefValues = TabmixSvc.JSON.parse(prefString);
+    } catch (ex) {
+      handleError(ex);
+    }
+    if (currentPrefValues === null) {
+      handleError(ruleName + " value is invalid\n" + prefString);
     }
 
     // make sure we have all the item

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/tabmixplus.git



More information about the Pkg-mozext-commits mailing list