Example #1
0
    def _report_exception(self, exc, tb):
        try:
            _logger().critical('unhandled exception:\n%s', tb)
            _tb = tb
            if isinstance(exc, UnicodeDecodeError):
                # This might be the same exception in the same file but at another position
                # in the stream
                _tb = tb.splitlines()[-4]
            if _tb in self._reported_tracebacks:
                return
            self._reported_tracebacks.append(_tb)
            title = '[Unhandled exception] %s' % exc.__class__.__name__
            description = 'An unhandled exception has occured:\n\n'\
                          '%s\n\nWould like to send a bug report to the ' \
                          'development team?' % tb
            answer = QtWidgets.QMessageBox.critical(
                self.win, title, description,
                QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No,
                QtWidgets.QMessageBox.Yes)
            if answer == QtWidgets.QMessageBox.Yes:
                description = '## Steps to reproduce\n\nPLEASE DESCRIBE '\
                    'THE CONTEXT OF THIS BUG AND THE STEPS TO REPRODUCE!\n\n'\
                    '## Traceback\n\n```\n%s\n```' % tb
                DlgReportBug.report_bug(
                    self.win, title=title, description=description)

        except Exception:
            _logger().exception('exception in excepthook')
Example #2
0
    def _report_exception(self, exc, tb):
        try:
            _logger().critical('unhandled exception:\n%s', tb)
            _tb = tb
            if isinstance(exc, UnicodeDecodeError):
                # This might be the same exception in the same file but at another position
                # in the stream
                _tb = tb.splitlines()[-4]
            if _tb in self._reported_tracebacks:
                return
            self._reported_tracebacks.append(_tb)
            title = '[Unhandled exception] %s' % exc.__class__.__name__
            description = 'An unhandled exception has occured:\n\n'\
                          '%s\n\nWould like to send a bug report to the ' \
                          'development team?' % tb
            answer = QtWidgets.QMessageBox.critical(
                self.win, title, description,
                QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No,
                QtWidgets.QMessageBox.Yes)
            if answer == QtWidgets.QMessageBox.Yes:
                description = '## Steps to reproduce\n\nPLEASE DESCRIBE '\
                    'THE CONTEXT OF THIS BUG AND THE STEPS TO REPRODUCE!\n\n'\
                    '## Traceback\n\n```\n%s\n```' % tb
                DlgReportBug.report_bug(self.win,
                                        title=title,
                                        description=description)

        except Exception:
            _logger().exception('exception in excepthook')
Example #3
0
 def report_bug(self):
     DlgReportBug.report_bug(self.main_window)
Example #4
0
 def report_bug(self):
     DlgReportBug.report_bug(self.main_window)