ternjs / tern_for_vim

Tern plugin for Vim
MIT License
1.83k stars 100 forks source link

Cryptic python exception is shown when node.js binary isn't found #75

Closed staticshock closed 10 years ago

staticshock commented 10 years ago

A recent Ubuntu upgrade recently renamed /usr/bin/node to /usr/bin/nodejs for me, which resulted in the following exception thrown whenever a javascript buffer loses focus:

Error detected while processing BufLeave Auto commands for "<buffer=1>":
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "~/.dotfiles/.vim/bundle/tern_for_vim/script/tern.py", line 204, in tern_sendBufferIfDirty
    if curSeq > vim.eval("b:ternBufferSentAt") and tern_sendBuffer():
  File "~/.dotfiles/.vim/bundle/tern_for_vim/script/tern.py", line 192, in tern_sendBuffer
    port, _portIsOld = tern_findServer()
  File "~/.dotfiles/.vim/bundle/tern_for_vim/script/tern.py", line 70, in tern_findServer
    return (tern_startServer(project), False)
  File "~/.dotfiles/.vim/bundle/tern_for_vim/script/tern.py", line 83, in tern_startServer
    stderr=subprocess.STDOUT, shell=win)
  File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

This happens, for instance, on :bdel or on :help. It could be a bit more user-friendly if it mentioned which specific executable was missing.