Improve bug messages.

Refs #4635
This commit is contained in:
Gunnar Beutner 2013-11-15 09:04:39 +01:00 committed by Gunnar Beutner
parent e368c43081
commit 4ed798385d
3 changed files with 35 additions and 8 deletions

View File

@ -94,7 +94,7 @@ check_function_exists(pipe2 HAVE_PIPE2)
check_library_exists(crypto BIO_f_zlib "" HAVE_BIOZLIB)
include(GNUInstallDirs)
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h ESCAPE_QUOTES)
install(
FILES README COPYING COPYING.Exceptions AUTHORS ChangeLog INSTALL NEWS

View File

@ -311,17 +311,32 @@ bool Application::IsDebugging(void)
return m_Debugging;
}
/**
* Display version information.
*/
void Application::DisplayVersionMessage(void)
{
std::cerr << "***" << std::endl
<< "* Application version: " << GetVersion() << std::endl
<< "* Installation root: " << GetPrefixDir() << std::endl
<< "* Local state directory: " << GetLocalStateDir() << std::endl
<< "* Package data directory: " << GetPkgDataDir() << std::endl
<< "* State path: " << GetStatePath() << std::endl
<< "* PID path: " << GetPidPath() << std::endl
<< "* Application type: " << GetApplicationType() << std::endl
<< "***" << std::endl;
}
/**
* Displays a message that tells users what to do when they encounter a bug.
*/
void Application::DisplayBugMessage(void)
{
std::cerr << "***" << std::endl
<< "*** This would indicate a runtime problem or configuration error. If you believe this is a bug in Icinga 2" << std::endl
<< "*** please submit a bug report at https://dev.icinga.org/ and include this stack trace as well as any other" << std::endl
<< "*** information that might be useful in order to reproduce this problem." << std::endl
<< "***" << std::endl
<< std::endl;
<< "* This would indicate a runtime problem or configuration error. If you believe this is a bug in Icinga 2" << std::endl
<< "* please submit a bug report at https://dev.icinga.org/ and include this stack trace as well as any other" << std::endl
<< "* information that might be useful in order to reproduce this problem." << std::endl
<< "***" << std::endl;
}
#ifndef _WIN32
@ -360,7 +375,10 @@ void Application::SigAbrtHandler(int)
sigaction(SIGABRT, &sa, NULL);
#endif /* _WIN32 */
std::cerr << "Caught SIGABRT." << std::endl;
std::cerr << "Caught SIGABRT." << std::endl
<< std::endl;
DisplayVersionMessage();
StackTrace trace;
std::cerr << "Stacktrace:" << std::endl;
@ -399,6 +417,11 @@ void Application::ExceptionHandler(void)
sigaction(SIGABRT, &sa, NULL);
#endif /* _WIN32 */
std::cerr << "Caught unhandled exception." << std::endl
<< std::endl;
DisplayVersionMessage();
try {
throw;
} catch (const std::exception& ex) {
@ -415,7 +438,10 @@ void Application::ExceptionHandler(void)
#ifdef _WIN32
LONG CALLBACK Application::SEHUnhandledExceptionFilter(PEXCEPTION_POINTERS exi)
{
std::cerr << "Unhandled SEH exception." << std::endl;
DisplayVersionMessage();
std::cerr << "Caught unhandled SEH exception." << std::endl
<< std::endl;
StackTrace trace(exi);
std::cerr << "Stacktrace:" << std::endl;

View File

@ -122,6 +122,7 @@ private:
static LONG WINAPI SEHUnhandledExceptionFilter(PEXCEPTION_POINTERS exi);
#endif /* _WIN32 */
static void DisplayVersionMessage(void);
static void DisplayBugMessage(void);
static void SigAbrtHandler(int signum);