|
7 | 7 | #include "Common/Cpp/Exceptions.h" |
8 | 8 | #include "Common/Cpp/Concurrency/SpinPause.h" |
9 | 9 | #include "CommonFramework/GlobalSettingsPanel.h" |
| 10 | +#include "CommonFramework/ErrorReports/ErrorReports.h" |
10 | 11 | #include "CommonFramework/Exceptions/ProgramFinishedException.h" |
11 | 12 | #include "CommonFramework/Options/Environment/SleepSuppressOption.h" |
12 | 13 | #include "CommonFramework/Options/Environment/PerformanceOptions.h" |
@@ -91,12 +92,36 @@ void SingleSwitchProgramSession::run_program_instance(SingleSwitchProgramEnviron |
91 | 92 | try{ |
92 | 93 | m_option.instance().program(env, context); |
93 | 94 | context.wait_for_all_requests(); |
94 | | - }catch (...){ |
| 95 | + }catch (Exception& e){ |
95 | 96 | try{ |
96 | 97 | env.console.controller().cancel_all_commands(); |
97 | 98 | }catch (...){} |
98 | 99 | std::lock_guard<std::mutex> lg(program_lock()); |
99 | 100 | m_scope.store(nullptr, std::memory_order_release); |
| 101 | + |
| 102 | + std::vector<std::pair<std::string, std::string>> embeds; |
| 103 | + if (!e.message().empty()){ |
| 104 | + embeds.emplace_back(std::pair<std::string, std::string>("Message:", e.message())); |
| 105 | + } |
| 106 | + std::string title = "UNRECOVERABLE ERROR: "; |
| 107 | + title.push_back(*e.name()); |
| 108 | + PokemonAutomation::report_error( |
| 109 | + &env.logger(), |
| 110 | + env.program_info(), |
| 111 | + title, |
| 112 | + embeds, |
| 113 | + ImageViewRGB32(), |
| 114 | + nullptr |
| 115 | + ); |
| 116 | + |
| 117 | + send_program_notification( |
| 118 | + env, m_option.instance().NOTIFICATION_ERROR_FATAL, |
| 119 | + COLOR_RED, |
| 120 | + title, |
| 121 | + std::move(embeds), "", |
| 122 | + ImageViewRGB32() |
| 123 | + ); |
| 124 | + |
100 | 125 | throw; |
101 | 126 | } |
102 | 127 | #else |
|
0 commit comments