Skip to content

Commit 22b8442

Browse files
committed
Message box describing fatal exception is now presented
1 parent 1a644c3 commit 22b8442

File tree

1 file changed

+27
-10
lines changed

1 file changed

+27
-10
lines changed

frontend/gtkmm/main.cc

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,47 @@
88

99
#ifdef _WIN32
1010
#include <Windows.h>
11+
#include <stdlib.h>
1112
#endif
1213

13-
// Cadabra frontend with GTK+ interface (using gtkmm).
14+
// Cadabra frontend with GTK+ interface (using gtkmm).
1415
// Makes use of the client classes in the client_server directory.
1516

1617
int main(int argc, char **argv)
17-
{
18+
{
1819
try {
1920
auto application = Cadabra::create(argc, argv);
2021
const int status = application->run();
2122
return status;
22-
}
23-
catch(Glib::Error& er) {
23+
}
24+
catch (Glib::Error& er) {
2425
std::cerr << er.what() << std::endl;
2526
return -1;
26-
}
27-
catch(std::exception& ex) {
28-
std::cerr << ex.what() << std::endl;
29-
}
3027
}
28+
catch (std::exception& ex) {
29+
std::cerr << ex.what() << std::endl;
30+
}
31+
}
3132

3233
#if defined(_WIN32) && defined(NDEBUG)
3334
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
3435
{
35-
main(0, 0);
36+
try {
37+
auto application = Cadabra::create(__argc, __argv);
38+
const int status = application->run();
39+
return status;
40+
}
41+
catch (Glib::Error& er) {
42+
Gtk::MessageDialog(er.what()).run();
43+
return -1;
44+
}
45+
catch (std::exception& ex) {
46+
Gtk::MessageDialog(ex.what()).run();
47+
return -1;
48+
}
49+
catch (...) {
50+
Gtk::MessageDialog("An unknown error occured :(").run();
51+
throw;
52+
}
3653
}
37-
#endif
54+
#endif

0 commit comments

Comments
 (0)