Browse Source

Fix bare catch statement in coffee.

FelisCatus 7 năm trước cách đây
mục cha
commit
4e0b8975bd

+ 1 - 1
omega-pac/src/conditions.coffee

@@ -97,7 +97,7 @@ module.exports = exports =
   safeRegex: (expr) ->
     try
       new RegExp(expr)
-    catch
+    catch _
       # Invalid regexp! Fall back to a regexp that does not match anything.
       /(?!)/
 

+ 1 - 1
omega-pac/test/profiles.coffee

@@ -27,7 +27,7 @@ describe 'Profiles', ->
           chai.assert.equal(matchResult.source, expected.source)
         else
           chai.assert.deepEqual(matchResult, expected)
-      catch
+      catch _
         printResult = JSON.stringify(matchResult)
         msg = ("expect profile to return #{JSON.stringify(expected)} " +
                 "instead of #{printResult} for request #{o_request}")

+ 1 - 1
omega-target-chromium-extension/src/coffee/background.coffee

@@ -8,7 +8,7 @@ Log = OmegaTargetCurrent.Log
 _writeLogToLocalStorage = (content) ->
   try
     localStorage['log'] += content
-  catch
+  catch _
     # Maybe we have reached our limit here. See #1288. Try trimming it.
     localStorage['log'] = content
 

+ 1 - 1
omega-target-chromium-extension/src/module/chrome_port.coffee

@@ -13,7 +13,7 @@ module.exports = class ChromePort
     @postMessage = (args...) =>
       try
         @port.postMessage(args...)
-      catch
+      catch _
         return
 
     @onMessage = new TrackedEvent(@port.onMessage)

+ 1 - 1
omega-target-chromium-extension/src/module/parse_external_profile.coffee

@@ -46,7 +46,7 @@ module.exports = (details, options, fixedProfileConfig) ->
               [profileName, revision] = tokens
               try
                 profileName = JSON.parse(profileName)
-              catch
+              catch _
                 profileName = null
               if profileName and revision
                 profile = OmegaPac.Profiles.byName(profileName, options)

+ 1 - 1
omega-target-chromium-extension/src/module/switchysharp.coffee

@@ -52,6 +52,6 @@ module.exports = class SwitchySharp
       @port?.onMessage.addListener(@_onMessage.bind(this))
     try
       @port.postMessage({action: 'disable'})
-    catch
+    catch _
       @port = null
     return @port?

+ 1 - 1
omega-target-chromium-extension/src/module/tabs.coffee

@@ -88,7 +88,7 @@ class ChromeTabs
   _chromeSetIcon: (params) ->
     try
       chrome.browserAction.setIcon?(params, @ignoreError)
-    catch
+    catch _
       # Some legacy Chrome versions will panic if there are other icon sizes.
       params.imageData = {19: params.imageData[19], 38: params.imageData[38]}
       chrome.browserAction.setIcon?(params, @ignoreError)

+ 1 - 1
omega-target/src/options.coffee

@@ -248,7 +248,7 @@ class Options
         try
           Buffer = require('buffer').Buffer
           options = new Buffer(options, 'base64').toString('utf8')
-        catch
+        catch _
           options = null
       options = try JSON.parse(options)
     if not options

+ 1 - 1
omega-web/src/omega/controllers/about.coffee

@@ -10,5 +10,5 @@ angular.module('omega').controller 'AboutCtrl', ($scope, $rootScope,
 
   try
     $scope.version = omegaDebug.getProjectVersion()
-  catch
+  catch _
     $scope.version = '?.?.?'

+ 1 - 1
omega-web/src/omega/controllers/switch_profile.coffee

@@ -196,7 +196,7 @@ angular.module('omega').controller 'SwitchProfileCtrl', ($scope, $rootScope,
     if condition.conditionType.indexOf('Regex') >= 0
       try
         new RegExp(pattern)
-      catch
+      catch _
         return false
     return true