Example #1
0
    def error_handler(self, continue_working, share, name, email, textBox):
        status = -1
        if share == 0:
            errorReporter = ErrorReporter("mantidplot",
                                          UsageService.getUpTime(),
                                          self._exit_code, True, str(name),
                                          str(email), str(textBox))
            status = errorReporter.sendErrorReport()
        elif share == 1:
            errorReporter = ErrorReporter("mantidplot",
                                          UsageService.getUpTime(),
                                          self._exit_code, False, str(name),
                                          str(email), str(textBox))
            status = errorReporter.sendErrorReport()

        if status != 201:
            self._view.display_message_box(
                'Error contacting server',
                'There was an error when sending the report.'
                'Please contact [email protected] directly',
                'http request returned with status {}'.format(status))
            self.error_log.error(
                "Failed to send error report http request returned status {}".
                format(status))

        if not continue_working:
            self.error_log.error("Terminated by user.")
            self._view.quit()
        else:
            self.error_log.error("Continue working.")
Example #2
0
    def share_all_information(self, continue_working, name, email, text_box):
        uptime = UsageService.getUpTime()
        try:
            recovery_archive, file_hash = zip_recovery_directory()
        except Exception as exc:
            self.error_log.information(
                "Error creating recovery archive: {}. No recovery information will be sent"
            )
            recovery_archive, file_hash = None, ""
        status = self._send_report_to_server(share_identifiable=True,
                                             uptime=uptime,
                                             name=name,
                                             email=email,
                                             file_hash=file_hash,
                                             text_box=text_box)
        self.error_log.notice("Sent full information")
        if status == 201 and recovery_archive:
            self._upload_recovery_file(recovery_archive=recovery_archive)
            try:
                os.remove(recovery_archive)
            except OSError as exc:
                self.error_log.information(
                    "Unable to remove zipped recovery information: {}".format(
                        str(exc)))

        self._handle_exit(continue_working)
        return status
Example #3
0
 def share_non_identifiable_information(self, continue_working):
     uptime = UsageService.getUpTime()
     status = self._send_report_to_server(share_identifiable=False,
                                          uptime=uptime)
     self.error_log.notice("Sent non-identifiable information")
     self._handle_exit(continue_working)
     return status
Example #4
0
    def error_handler(self, continue_working, share, name, email):
        if share == 0:
            errorReporter = ErrorReporter("mantidplot",
                                          UsageService.getUpTime(),
                                          self._exit_code, True, str(name),
                                          str(email))
            errorReporter.sendErrorReport()
        elif share == 1:
            errorReporter = ErrorReporter("mantidplot",
                                          UsageService.getUpTime(),
                                          self._exit_code, False, str(name),
                                          str(email))
            errorReporter.sendErrorReport()

        if not continue_working:
            self.error_log.error("Terminated by user.")
            self._view.quit()
        else:
            self.error_log.error("Continue working.")
Example #5
0
 def share_non_identifiable_information(self, continue_working, text_box):
     uptime = UsageService.getUpTime()
     status = self._send_report_to_server(share_identifiable=False,
                                          uptime=uptime,
                                          text_box=text_box)
     self.error_log.notice("Sent non-identifiable information")
     self._handle_exit(continue_working)
     if not self._view.rememberContactInfoCheckbox.checkState():
         self.forget_contact_info()
     return status
Example #6
0
    def share_all_information(self, continue_working, name, email, text_box):
        uptime = UsageService.getUpTime()
        status = self._send_report_to_server(share_identifiable=True,
                                             uptime=uptime,
                                             name=name,
                                             email=email,
                                             text_box=text_box)
        self.error_log.notice("Sent full information")

        self._handle_exit(continue_working)
        return status
Example #7
0
    def show_more_details(self):
        error_reporter = ErrorReporter(
            self._application, UsageService.getUpTime(), self._exit_code, True,
            str(self._view.input_name_line_edit.text()),
            str(self._view.input_email_line_edit.text()),
            str(self._view.input_free_text.toPlainText()),
            "".join(self._traceback))

        error_message_json = json.loads(error_reporter.generateErrorMessage())
        stacktrace_text = error_message_json["stacktrace"]
        del error_message_json[
            "stacktrace"]  # remove this entry so it doesn't appear twice.
        user_information = ''.join(
            '{}: {}\n'.format(key, error_message_json[key])
            for key in error_message_json)
        self._view.display_more_details(user_information, stacktrace_text)
    def share_all_information(self, continue_working, name, email, text_box):
        uptime = UsageService.getUpTime()
        try:
            recovery_archive, file_hash = zip_recovery_directory()
        except Exception as exc:
            self.error_log.information("Error creating recovery archive: {}. No recovery information will be sent")
            recovery_archive, file_hash = None, ""
        status = self._send_report_to_server(share_identifiable=True, uptime=uptime, name=name, email=email, file_hash=file_hash,
                                             text_box=text_box)
        self.error_log.notice("Sent full information")
        if status == 201 and recovery_archive:
            self._upload_recovery_file(recovery_archive=recovery_archive)
            try:
                os.remove(recovery_archive)
            except OSError as exc:
                self.error_log.information("Unable to remove zipped recovery information: {}".format(str(exc)))

        self._handle_exit(continue_working)
        return status
Example #9
0
    def share_all_information(self, continue_working, new_name, new_email,
                              text_box):
        uptime = UsageService.getUpTime()
        status = self._send_report_to_server(share_identifiable=True,
                                             uptime=uptime,
                                             name=new_name,
                                             email=new_email,
                                             text_box=text_box)
        self.error_log.notice("Sent full information")
        self._handle_exit(continue_working)

        # Remember name and email in QSettings
        if self._view.rememberContactInfoCheckbox.checkState():
            settings = QSettings()
            settings.beginGroup(self._view.CONTACT_INFO)
            settings.setValue(self._view.NAME, new_name)
            settings.setValue(self._view.EMAIL, new_email)
            settings.endGroup()
        else:
            self.forget_contact_info()
        return status
 def share_non_identifiable_information(self, continue_working):
     uptime = UsageService.getUpTime()
     status = self._send_report_to_server(share_identifiable=False, uptime=uptime)
     self.error_log.notice("Sent non-identifiable information")
     self._handle_exit(continue_working)
     return status