예제 #1
0
    def wrapper(self, *args, **kwds):
        try:
            return func(self, *args, **kwds)
        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
https://github.com/SirVer/ultisnips/issues/new.

Following is the full stack trace:
"""

            msg += traceback.format_exc()
            if hasattr(e, "snippet_info"):
                msg += "\nSnippet, caused error:\n"
                msg += re.sub("^(?=\S)", "  ", e.snippet_info, flags=re.MULTILINE)
            # snippet_code comes from _python_code.py, it's set manually for
            # providing error message with stacktrace of failed python code
            # inside of the snippet.
            if hasattr(e, "snippet_code"):
                _, _, tb = sys.exc_info()
                tb_top = traceback.extract_tb(tb)[-1]
                msg += "\nExecuted snippet code:\n"
                lines = e.snippet_code.split("\n")
                for number, line in enumerate(lines, 1):
                    msg += str(number).rjust(3)
                    prefix = "   " if line else ""
                    if tb_top[1] == number:
                        prefix = " > "
                    msg += prefix + line + "\n"

            # Vim sends no WinLeave msg here.
            self._leaving_buffer()  # pylint:disable=protected-access
            _vim.new_scratch_buffer(msg)
예제 #2
0
    def wrapper(self, *args, **kwds):
        try:
            return f(self, *args, **kwds)
        except:
            s = """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
https://bugs.launchpad.net/ultisnips/+filebug.

Following is the full stack trace:
"""
            s += traceback.format_exc()
            self.leaving_buffer()  # Vim sends no WinLeave msg here.
            _vim.new_scratch_buffer(s)
예제 #3
0
    def wrapper(self, *args, **kwds):
        try:
            return f(self, *args, **kwds)
        except:
            s = \
"""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
https://bugs.launchpad.net/ultisnips/+filebug.

Following is the full stack trace:
"""
            s += traceback.format_exc()
            self.leaving_buffer()  # Vim sends no WinLeave msg here.
            _vim.new_scratch_buffer(s)
예제 #4
0
    def wrapper(self, *args, **kwds):
        try:
            return func(self, *args, **kwds)
        except:  # 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
https://github.com/SirVer/ultisnips/issues/new.

Following is the full stack trace:
"""
            msg += traceback.format_exc()
            # Vim sends no WinLeave msg here.
            self._leaving_buffer()  # pylint:disable=protected-access
            _vim.new_scratch_buffer(msg)
예제 #5
0
    def wrapper(self, *args, **kwds):
        try:
            return func(self, *args, **kwds)
        except:  # 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
https://github.com/SirVer/ultisnips/issues/new.

Following is the full stack trace:
"""
            msg += traceback.format_exc()
            # Vim sends no WinLeave msg here.
            self._leaving_buffer()  # pylint:disable=protected-access
            _vim.new_scratch_buffer(msg)
예제 #6
0
    def wrapper(self, *args, **kwds):
        try:
            return f(self, *args, **kwds)
        except:
            s = \
"""An error occured. This is either a bug in UltiSnips or a bug in a
snippet definition.  See doc/UltiSnips-Quickstart.txt about how to contact the
maintainer for this UltiSnips fork and where you should file a bug report


Following is the full stack trace:
"""
            s += traceback.format_exc()
            self.leaving_buffer() # Vim sends no WinLeave msg here.
            _vim.new_scratch_buffer(s)
예제 #7
0
    def wrapper(self, *args, **kwds):
        try:
            return f(self, *args, **kwds)
        except:
            s = \
"""An error occured. This is either a bug in UltiSnips or a bug in a
snippet definition.  See doc/UltiSnips-Quickstart.txt about how to contact the
maintainer for this UltiSnips fork and where you should file a bug report


Following is the full stack trace:
"""
            s += traceback.format_exc()
            self.leaving_buffer() # Vim sends no WinLeave msg here.
            _vim.new_scratch_buffer(s)
    def wrapper(self, *args, **kwds):
        try:
            return func(self, *args, **kwds)
        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
https://github.com/SirVer/ultisnips/issues/new
Please read and follow:
https://github.com/SirVer/ultisnips/blob/master/CONTRIBUTING.md#reproducing-bugs

Following is the full stack trace:
"""

            msg += traceback.format_exc()
            if hasattr(e, 'snippet_info'):
                msg += "\nSnippet, caused error:\n"
                msg += re.sub('^(?=\S)',
                              '  ',
                              e.snippet_info,
                              flags=re.MULTILINE)
            # snippet_code comes from _python_code.py, it's set manually for
            # providing error message with stacktrace of failed python code
            # inside of the snippet.
            if hasattr(e, 'snippet_code'):
                _, _, tb = sys.exc_info()
                tb_top = traceback.extract_tb(tb)[-1]
                msg += "\nExecuted snippet code:\n"
                lines = e.snippet_code.split("\n")
                for number, line in enumerate(lines, 1):
                    msg += str(number).rjust(3)
                    prefix = "   " if line else ""
                    if tb_top[1] == number:
                        prefix = " > "
                    msg += prefix + line + "\n"

            # Vim sends no WinLeave msg here.
            if hasattr(self, '_leaving_buffer'):
                self._leaving_buffer()  # pylint:disable=protected-access
            _vim.new_scratch_buffer(msg)