Skip to content

Commit

Permalink
Write exception traceback to Vim log
Browse files Browse the repository at this point in the history
  • Loading branch information
nixprime committed Oct 31, 2017
1 parent 8e61bf3 commit cdd05cf
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion autoload/cpsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import os
import sys
import traceback
import vim

script_dir = vim.eval("s:script_dir")
Expand Down Expand Up @@ -45,8 +46,14 @@ def ctrlp_match():
vim.command("let s:regexes = [%s]" % ",".join(
map(_escape_and_quote, regexes)))
except Exception as ex:
# Log the exception. Unfortunately something CtrlP causes all messages
# to be discarded, so this is only visible in Vim verbose logging.
print("cpsm error:")
traceback.print_exc(file=sys.stdout)
# Return a short error message in the results.
ex_str = str(ex)
if "function takes at most" in ex_str:
if (sys.exc_info()[0] is TypeError and
"function takes at most" in ex_str):
# Most likely due to a new parameter being added to
# cpsm_py.ctrlp_match.
ex_str = "rebuild cpsm by running %s: %s" % (
Expand Down

0 comments on commit cdd05cf

Please sign in to comment.