facecam2d/src/error.cpp

26 lines
589 B
C++
Raw Normal View History

#include <iostream>
#ifndef NO_GRAPHICAL_DIALOG
#include <boxer/boxer.h>
#endif
void showError(std::string message, std::string titleMessage, bool fatal = true) {
#ifndef NO_GRAPHICAL_DIALOG
boxer::show(message.c_str(), titleMessage.c_str(), boxer::Style::Error);
#endif
std::cerr << "ERROR: " << message << std::endl;
if (fatal) {
std::abort();
}
}
void showWarning(std::string message, std::string titleMessage) {
#ifndef NO_GRAPHICAL_DIALOG
boxer::show(message.c_str(), titleMessage.c_str(), boxer::Style::Warning);
#endif
std::cerr << "WARN: " << message << std::endl;
}