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):
|
def wrapper(self, *args, **kwds):
|
||||||
try:
|
try:
|
||||||
return func(self, *args, **kwds)
|
return func(self, *args, **kwds)
|
||||||
except: # pylint: disable=bare-except
|
except Exception as e: # pylint: disable=bare-except
|
||||||
msg = \
|
msg = \
|
||||||
"""An error occured. This is either a bug in UltiSnips or a bug in a
|
"""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
|
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:
|
Following is the full stack trace:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
msg += traceback.format_exc()
|
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.
|
# Vim sends no WinLeave msg here.
|
||||||
self._leaving_buffer() # pylint:disable=protected-access
|
self._leaving_buffer() # pylint:disable=protected-access
|
||||||
_vim.new_scratch_buffer(msg)
|
_vim.new_scratch_buffer(msg)
|
||||||
|
@ -266,8 +266,13 @@ class PythonCode(NoneditableTextObject):
|
|||||||
})
|
})
|
||||||
self._snip._reset(ct) # pylint:disable=protected-access
|
self._snip._reset(ct) # pylint:disable=protected-access
|
||||||
|
|
||||||
|
|
||||||
for code in self._codes:
|
for code in self._codes:
|
||||||
|
try:
|
||||||
exec(code, self._locals) # pylint:disable=exec-used
|
exec(code, self._locals) # pylint:disable=exec-used
|
||||||
|
except Exception as e:
|
||||||
|
e.code = code
|
||||||
|
raise
|
||||||
|
|
||||||
rv = as_unicode(
|
rv = as_unicode(
|
||||||
self._snip.rv if self._snip._rv_changed # pylint:disable=protected-access
|
self._snip.rv if self._snip._rv_changed # pylint:disable=protected-access
|
||||||
|
Loading…
Reference in New Issue
Block a user