Skip to content

Commit

Permalink
Merge pull request #23053 from mantidproject/23035_error_reporting_no…
Browse files Browse the repository at this point in the history
…t_reporting

Fix error reporter not reporting to database
  • Loading branch information
martyngigg authored Jul 24, 2018
2 parents 6cf6f37 + b41d986 commit fac942f
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 13 deletions.
3 changes: 3 additions & 0 deletions Framework/Kernel/src/ErrorReporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ std::string ErrorReporter::generateErrorMessage() {
if (m_share) {
message["email"] = m_email;
message["name"] = m_name;
} else {
message["email"] = "";
message["name"] = "";
}

::Json::FastWriter writer;
Expand Down
1 change: 1 addition & 0 deletions MantidPlot/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,7 @@ qt4_add_resources ( RES_FILES ${PROJECT_SOURCE_DIR}/images/images.qrc )
qt4_add_resources ( RES_FILES ${PROJECT_SOURCE_DIR}/images/MantidWidgets.qrc )
qt4_add_resources ( RES_FILES ${PROJECT_SOURCE_DIR}/images//fonts/fonts.qrc )
qt4_add_resources ( RES_FILES ${CMAKE_CURRENT_SOURCE_DIR}/icons/icons.qrc )
qt4_add_resources ( RES_FILES ${PROJECT_SOURCE_DIR}/scripts/ErrorReporter/errorreporter.qrc )

###########################################################################
# Add the dependencies
Expand Down
3 changes: 2 additions & 1 deletion MantidPlot/src/Mantid/MantidApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ bool MantidApplication::notify(QObject *receiver, QEvent *event) {
"ErrorReporterPresenter"
"\nfrom ErrorReporter.errorreport import CrashReportPage"
"\npage = CrashReportPage(show_continue_terminate=True)"
"\npresenter = ErrorReporterPresenter(page, '')");
"\npresenter = ErrorReporterPresenter(page, '')"
"\npresenter.show_view()");

emit runAsPythonScript(pythonCode);
} else if (error) {
Expand Down
4 changes: 3 additions & 1 deletion scripts/ErrorReporter/error_dialog_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ def main():
return int(command_line_args.exit_code)
app = QtGui.QApplication(sys.argv)
form = CrashReportPage(show_continue_terminate=False)
ErrorReporterPresenter(form, command_line_args.exit_code)
presenter = ErrorReporterPresenter(form, command_line_args.exit_code)
presenter.show_view()
app.exec_()
return int(command_line_args.exit_code)


if __name__ == '__main__': # if we're running file directly and not importing it
sys.exit(main()) # run the main function
16 changes: 8 additions & 8 deletions scripts/ErrorReporter/error_report_presenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@
from mantid.kernel import Logger


class ErrorReporterPresenter():
class ErrorReporterPresenter(object):
def __init__(self, view, exit_code):
self.error_log = Logger("error")
self._view = view
self._exit_code = exit_code
self._view.connect_signal(self.error_handler)
self._view.show()
self.error_log = Logger("error")
self._view.action.connect(self.error_handler)

def error_handler(self, continue_working, share, name, email):
if share == 0:
errorReporter = ErrorReporter(
"mantidplot",UsageService.getUpTime(), UsageService.isEnabled(), self._exit_code,
True, str(name), str(email))
"mantidplot", UsageService.getUpTime(), self._exit_code, True, str(name), str(email))
errorReporter.sendErrorReport()
elif share == 1:
errorReporter = ErrorReporter(
"mantidplot",UsageService.getUpTime(), UsageService.isEnabled(), self._exit_code,
False, str(name), str(email))
"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.")

def show_view(self):
self._view.show()
3 changes: 0 additions & 3 deletions scripts/ErrorReporter/errorreport.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ def __init__(self, parent=None, show_continue_terminate=False):
def quit (self):
self.quit_signal.emit()

def connect_signal(self, slot):
self.action.connect(slot)

def fullShare(self):
self.action.emit(self.continue_working, 0, self.input_name, self.input_email)
self.close()
Expand Down

0 comments on commit fac942f

Please sign in to comment.