print executed code
This commit is contained in:
parent
cc6ac3c064
commit
00e3a877d9
@ -57,7 +57,7 @@ def err_to_scratch_buffer(func):
|
||||
def wrapper(self, *args, **kwds):
|
||||
try:
|
||||
return func(self, *args, **kwds)
|
||||
except: # pylint: disable=bare-except
|
||||
except Exception as e: # pylint: disable=bare-except
|
||||
msg = \
|
||||
"""An error occured. This is either a bug in UltiSnips or a bug in a
|
||||
snippet definition. If you think this is a bug, please report it to
|
||||
@ -65,7 +65,16 @@ https://github.com/SirVer/ultisnips/issues/new.
|
||||
|
||||
Following is the full stack trace:
|
||||
"""
|
||||
|
||||
msg += traceback.format_exc()
|
||||
if hasattr(e, 'code'):
|
||||
msg += "\nFollowing is the full executed code:\n"
|
||||
lines = e.code.split("\n")
|
||||
number = 1
|
||||
for line in lines:
|
||||
msg += str(number) + ": " + line + "\n"
|
||||
number += 1
|
||||
|
||||
# Vim sends no WinLeave msg here.
|
||||
self._leaving_buffer() # pylint:disable=protected-access
|
||||
_vim.new_scratch_buffer(msg)
|
||||
|
@ -266,8 +266,13 @@ class PythonCode(NoneditableTextObject):
|
||||
})
|
||||
self._snip._reset(ct) # pylint:disable=protected-access
|
||||
|
||||
|
||||
for code in self._codes:
|
||||
exec(code, self._locals) # pylint:disable=exec-used
|
||||
try:
|
||||
exec(code, self._locals) # pylint:disable=exec-used
|
||||
except Exception as e:
|
||||
e.code = code
|
||||
raise
|
||||
|
||||
rv = as_unicode(
|
||||
self._snip.rv if self._snip._rv_changed # pylint:disable=protected-access
|
||||
|
Loading…
Reference in New Issue
Block a user