|
28 | 28 | #include <bridgepp/Log/Log.h> |
29 | 29 | #include <bridgepp/ProcessMonitor.h> |
30 | 30 | #include <sentry.h> |
| 31 | +#include <SentryUtils.h> |
31 | 32 | #include <project_sentry_config.h> |
32 | 33 |
|
33 | 34 |
|
@@ -238,7 +239,8 @@ void focusOtherInstance() { |
238 | 239 | } |
239 | 240 | catch (Exception const &e) { |
240 | 241 | app().log().error(e.qwhat()); |
241 | | - reportSentryException(SENTRY_LEVEL_ERROR, "Exception occurred during focusOtherInstance()", "Exception", e.what()); |
| 242 | + auto uuid = reportSentryException(SENTRY_LEVEL_ERROR, "Exception occurred during focusOtherInstance()", "Exception", e.what()); |
| 243 | + app().log().fatal(QString("reportID: %1 Captured exception: %2").arg(QByteArray(uuid.bytes, 16).toHex()).arg(e.qwhat())); |
242 | 244 | } |
243 | 245 | } |
244 | 246 |
|
@@ -296,13 +298,13 @@ int main(int argc, char *argv[]) { |
296 | 298 | const QString sentryCachePath = sentryCacheDir(); |
297 | 299 | sentry_options_set_database_path(sentryOptions, sentryCachePath.toStdString().c_str()); |
298 | 300 | } |
299 | | - sentry_options_set_release(sentryOptions, SentryProductID); |
| 301 | + sentry_options_set_release(sentryOptions, QByteArray(PROJECT_REVISION).toHex()); |
300 | 302 | // Enable this for debugging sentry. |
301 | 303 | // sentry_options_set_debug(sentryOptions, 1); |
302 | 304 | if (sentry_init(sentryOptions) != 0) { |
303 | 305 | std::cerr << "Failed to initialize sentry" << std::endl; |
304 | 306 | } |
305 | | - |
| 307 | + setSentryReportScope(); |
306 | 308 | auto sentryClose = qScopeGuard([] { sentry_close(); }); |
307 | 309 |
|
308 | 310 | // The application instance is needed to display system message boxes. As we may have to do it in the exception handler, |
@@ -426,9 +428,9 @@ int main(int argc, char *argv[]) { |
426 | 428 | return result; |
427 | 429 | } |
428 | 430 | catch (Exception const &e) { |
429 | | - reportSentryException(SENTRY_LEVEL_ERROR, "Exception occurred during main", "Exception", e.what()); |
| 431 | + auto uuid = reportSentryException(SENTRY_LEVEL_ERROR, "Exception occurred during main", "Exception", e.what()); |
430 | 432 | QMessageBox::critical(nullptr, "Error", e.qwhat()); |
431 | | - QTextStream(stderr) << e.qwhat() << "\n"; |
| 433 | + QTextStream(stderr) << "reportID: " << QByteArray(uuid.bytes, 16).toHex() << "Captured exception :" << e.qwhat() << "\n"; |
432 | 434 | return EXIT_FAILURE; |
433 | 435 | } |
434 | 436 | } |
0 commit comments