Skip to content

Commit b9daa85

Browse files
committed
Merge pull request #59 from Floobits/master
Show more information about problems in plugins being loaded.
2 parents d374df1 + 305373f commit b9daa85

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

neovim/plugin/host.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
__all__ = ('Host')
1414

1515
logger = logging.getLogger(__name__)
16-
debug, info, warn = (logger.debug, logger.info, logger.warn,)
16+
error, debug, info, warn = (logger.error, logger.debug, logger.info,
17+
logger.warn,)
1718

1819

1920
class Host(object):
@@ -77,7 +78,13 @@ def _load(self, plugins):
7778
raise Exception('{0} is already loaded'.format(path))
7879
directory, name = os.path.split(os.path.splitext(path)[0])
7980
file, pathname, description = find_module(name, [directory])
80-
module = imp.load_module(name, file, pathname, description)
81+
try:
82+
module = imp.load_module(name, file, pathname, description)
83+
except ImportError:
84+
error('Encountered import error loading plugin at %s' % path)
85+
except Exception as e:
86+
error('Error loading plugin at %s %s: %s' % (
87+
path, type(e).__name__, e))
8188
handlers = []
8289
self._discover_classes(module, handlers, path)
8390
self._discover_functions(module, handlers, path)

0 commit comments

Comments
 (0)