Skip to content

Commit 041cbfa

Browse files
committed
emsc: print uncaught exception info
1 parent 1f250a9 commit 041cbfa

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

src/ruisapp/glue/sdl/glue.cxx

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -754,14 +754,21 @@ void main_loop_iteration(void* user_data)
754754

755755
int main(int argc, const char** argv)
756756
{
757-
std::unique_ptr<ruisapp::application> app = ruisapp::application_factory::make_application(argc, argv);
758-
if (!app) {
759-
// Not an error. The application just did not show any GUI to the user.
760-
return 0;
761-
}
757+
try {
758+
std::unique_ptr<ruisapp::application> app = ruisapp::application_factory::make_application(argc, argv);
759+
if (!app) {
760+
// Not an error. The application just did not show any GUI to the user.
761+
return 0;
762+
}
762763

763-
while (!get_impl(*app).quit_flag.load()) {
764-
main_loop_iteration(app.get());
764+
while (!get_impl(*app).quit_flag.load()) {
765+
main_loop_iteration(app.get());
766+
}
767+
} catch (std::exception& e) {
768+
#if CFG_OS_NAME == CFG_OS_NAME_EMSCRIPTEN
769+
std::cout << "uncaught " << utki::to_string(e) << std::endl;
770+
#endif
771+
throw;
765772
}
766773

767774
return 0;

0 commit comments

Comments
 (0)