| 427 | #undef SHOW_EXCEPTION |
| 428 | |
| 429 | int AegisubApp::OnRun() { |
| 430 | std::string error; |
| 431 | |
| 432 | try { |
| 433 | return MainLoop(); |
| 434 | } |
| 435 | catch (const std::exception &e) { error = std::string("std::exception: ") + e.what(); } |
| 436 | catch (const agi::Exception &e) { error = "agi::exception: " + e.GetMessage(); } |
| 437 | catch (...) { error = "Program terminated in error."; } |
| 438 | |
| 439 | // Report errors |
| 440 | if (!error.empty()) { |
| 441 | crash_writer::Write(error); |
| 442 | OnUnhandledException(); |
| 443 | } |
| 444 | |
| 445 | ExitMainLoop(); |
| 446 | return 1; |
| 447 | } |
| 448 | |
| 449 | void AegisubApp::MacOpenFiles(wxArrayString const& filenames) { |
| 450 | OpenFiles(filenames); |