@@ -85,17 +85,20 @@ std::shared_ptr<const ImageRGB32> ScreenshotException::screenshot() const{
8585}
8686
8787
88- void ScreenshotException::send_notification (ProgramEnvironment& env, EventNotificationOption& notification) const {
88+ void ScreenshotException::send_notification (ProgramEnvironment& env, EventNotificationOption& notification, const std::string& title_prefix ) const {
8989 std::vector<std::pair<std::string, std::string>> embeds;
9090 if (!m_message.empty ()){
9191 embeds.emplace_back (std::pair<std::string, std::string>(" Message:" , m_message));
9292 }
9393
94+ std::string title = title_prefix;
95+ title.append (name ());
96+
9497 if (m_send_error_report == ErrorReport::SEND_ERROR_REPORT){
9598 report_error (
9699 &env.logger (),
97100 env.program_info (),
98- name () ,
101+ title ,
99102 embeds,
100103 screenshot_view (),
101104 m_stream ? &m_stream->history () : nullptr
@@ -111,40 +114,26 @@ void ScreenshotException::send_notification(ProgramEnvironment& env, EventNotifi
111114 );
112115}
113116
114- void ScreenshotException::send_fatal_notification (ProgramEnvironment& env) const {
115- std::vector<std::pair<std::string, std::string>> embeds;
116- if (!m_message.empty ()){
117- embeds.emplace_back (std::pair<std::string, std::string>(" Message:" , m_message));
118- }
119-
120- std::string title = " Fatal Error: " ;
121- title.append (name ());
117+ void ScreenshotException::send_recoverable_notification (ProgramEnvironment& env) const {
118+ EventNotificationOption recoverable_notification = EventNotificationOption (
119+ " Program Error (Recoverable)" ,
120+ true , true ,
121+ ImageAttachmentMode::JPG,
122+ {" Notifs" }
123+ );
122124
123- if (m_send_error_report == ErrorReport::SEND_ERROR_REPORT){
124- report_error (
125- &env.logger (),
126- env.program_info (),
127- title,
128- embeds,
129- screenshot_view (),
130- m_stream ? &m_stream->history () : nullptr
131- );
132- }
125+ send_notification (env, recoverable_notification, " Recoverable Error: " );
126+ }
133127
128+ void ScreenshotException::send_fatal_notification (ProgramEnvironment& env) const {
134129 EventNotificationOption fatal_notification = EventNotificationOption (
135130 " Program Error (Fatal)" ,
136131 true , true ,
137132 ImageAttachmentMode::JPG,
138133 {" Notifs" }
139134 );
140135
141- send_program_notification (
142- env, fatal_notification,
143- color (),
144- name (),
145- std::move (embeds), " " ,
146- screenshot_view ()
147- );
136+ send_notification (env, fatal_notification, " Recoverable Error: " );
148137}
149138
150139
0 commit comments