Skip to content

Commit

Permalink
Show crash report sending failure unconditionally
Browse files Browse the repository at this point in the history
  • Loading branch information
kryksyh committed Oct 15, 2024
1 parent 60af155 commit 36b58b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
17 changes: 6 additions & 11 deletions crashreporter/CrashReportApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ namespace
);

if(result != google_breakpad::RESULT_SUCCEEDED)
errorString = wxString::Format("SendMinidump filed with result: %s", StringifyReportResult(result));
errorString = wxString::Format("Failed to send crash report with error: %s", StringifyReportResult(result));

return result == google_breakpad::RESULT_SUCCEEDED;
}
Expand All @@ -94,7 +94,7 @@ namespace
files["comments.txt"] = commentsFilePath.ToStdString();
}

std::string response, error;
std::string response, resultErr;
bool success = google_breakpad::HTTPUpload::SendRequest(
url,
arguments,
Expand All @@ -104,10 +104,10 @@ namespace
std::string(),
&response,
NULL,
&error);
&resultErr);

if(!success)
errorString = wxString::Format("SendMinidump failed with error: %s", error.c_str());
error = wxString::Format("Failed to send crash report with error: %s", resultErr.c_str());

return success;
}
Expand Down Expand Up @@ -421,7 +421,7 @@ bool CrashReportApp::OnInit()
{
wxString error;
auto result = SendMinidump(mURL, mMinidumpPath, mArguments, wxEmptyString, error);
if(!result && mShowError)
if(!result)
wxMessageBox(error);
}
}
Expand Down Expand Up @@ -467,7 +467,6 @@ void CrashReportApp::OnInitCmdLine(wxCmdLineParser& parser)
static const wxCmdLineEntryDesc cmdLineEntryDesc[] =
{
{ wxCMD_LINE_SWITCH, "s", "silent", "Send without displaying the confirmation dialog" },
{wxCMD_LINE_SWITCH, "e", "error_code", "Show error code/message on sending failure" },
{ wxCMD_LINE_OPTION, "u", "url", "Crash report server URL", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
{ wxCMD_LINE_OPTION, "a", "args", "A set of arguments to send", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
{ wxCMD_LINE_PARAM, NULL, NULL, "path to minidump file", wxCMD_LINE_VAL_STRING, wxCMD_LINE_OPTION_MANDATORY },
Expand Down Expand Up @@ -501,7 +500,6 @@ bool CrashReportApp::OnCmdLineParsed(wxCmdLineParser& parser)
}
mMinidumpPath = parser.GetParam(0);
mSilent = parser.Found("s");
mShowError = parser.Found("e");

return wxApp::OnCmdLineParsed(parser);
}
Expand Down Expand Up @@ -538,10 +536,7 @@ void CrashReportApp::ShowCrashReport(const wxString& header, const wxString& tex

if (!result)
{
if(mShowError)
wxMessageBox(error);
else
wxMessageBox(_("Failed to send crash report"));
wxMessageBox(error);
}
return result;
});
Expand Down
1 change: 0 additions & 1 deletion crashreporter/CrashReportApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class CrashReportApp final : public wxApp
std::map<std::string, std::string> mArguments;

bool mSilent{ false };
bool mShowError { false };
public:
bool OnInit() override;
void OnInitCmdLine(wxCmdLineParser& parser) override;
Expand Down

0 comments on commit 36b58b9

Please sign in to comment.