Skip to content

Commit

Permalink
Display errors in messagebox on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
AMDmi3 committed Dec 22, 2015
1 parent ee3871c commit 47ba0be
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
* along with hoverboard-sdl. If not, see <http://www.gnu.org/licenses/>.
*/

#ifdef _WIN32
# include <windows.h>
#endif

#include <iostream>
#include <string>
#include <sstream>
Expand Down Expand Up @@ -148,10 +152,18 @@ int main(int, char*[]) try {

return 0;
} catch (std::exception& e) {
#ifdef _WIN32
MessageBox(nullptr, e.what(), "Error", MB_ICONERROR | MB_OK);
#else
std::cerr << "Error: " << e.what() << std::endl;
#endif
return 1;
} catch (...) {
#ifdef _WIN32
MessageBox(nullptr, "Unknown error", "Error", MB_ICONERROR | MB_OK);
#else
std::cerr << "Unknown error" << std::endl;
#endif
return 1;
}

0 comments on commit 47ba0be

Please sign in to comment.