Skip to content

Commit 44f850d

Browse files
committed
Merge pull request #40 from renstrom/no-bare-except
Do not use bare `except:`.
2 parents 55e1dff + 692a632 commit 44f850d

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

neovim/api/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ def __contains__(self, key):
5555
try:
5656
self._get(key)
5757
return True
58-
except:
58+
except Exception:
5959
return False
6060

6161
def get(self, key, default=None):
6262
"""Return value for key if present, else a default value."""
6363
try:
6464
return self._get(key)
65-
except:
65+
except Exception:
6666
return default
6767

6868

neovim/api/nvim.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def foreach_rtp(self, cb):
126126
try:
127127
if cb(path) is not None:
128128
break
129-
except:
129+
except Exception:
130130
break
131131

132132
def chdir(self, dir_path):

neovim/plugins/plugin_host.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def discover_plugins(self):
7777
loaded.add(name)
7878
try:
7979
discovered = find_module(name, [directory])
80-
except:
80+
except Exception:
8181
err_str = format_exc(5)
8282
warn('error while searching module %s: %s', name, err_str)
8383
continue
@@ -90,7 +90,7 @@ def discover_plugins(self):
9090
if name.startswith('Nvim'):
9191
self.discovered_plugins.append(value)
9292
debug('loaded %s', name)
93-
except:
93+
except Exception:
9494
err_str = format_exc(5)
9595
warn('error while loading module %s: %s', name, err_str)
9696
continue
@@ -107,7 +107,7 @@ def install_plugins(self):
107107
debug('inspecting class %s', plugin_class.__name__)
108108
try:
109109
plugin = plugin_class(self.nvim)
110-
except:
110+
except Exception:
111111
err_str = format_exc(5)
112112
warn('constructor for %s failed: %s', cls_name, err_str)
113113
continue

0 commit comments

Comments
 (0)