feat(GODT-2446): Attach logs to sentry reports for relevant bridge-gui exceptions.

Cherry picked from release/perth_narrows (2aa4e7c)

# Conflicts:
#	internal/frontend/bridge-gui/bridge-gui/AppController.cpp
#	internal/frontend/bridge-gui/bridge-gui/AppController.h
#	internal/frontend/bridge-gui/bridge-gui/LogUtils.cpp
#	internal/frontend/bridge-gui/bridge-gui/LogUtils.h
#	internal/frontend/bridge-gui/bridge-gui/QMLBackend.cpp
#	internal/frontend/bridge-gui/bridge-gui/SentryUtils.cpp
#	internal/frontend/bridge-gui/bridge-gui/SentryUtils.h
#	internal/frontend/bridge-gui/bridge-gui/main.cpp
This commit is contained in:
Xavier Michelon
2023-03-07 10:02:09 +01:00
parent 21ffde316d
commit febc994cec
12 changed files with 149 additions and 38 deletions

View File

@ -90,20 +90,14 @@ Settings &AppController::settings() {
//****************************************************************************************************************************************************
/// \param[in] function The function that caught the exception.
/// \param[in] message The error message.
/// \param[in] details The details for the error.
/// \param[in] exception The exception that triggered the fatal error.
//****************************************************************************************************************************************************
void AppController::onFatalError(QString const &function, QString const &message, QString const &details) {
QString fullMessage = QString("%1(): %2").arg(function, message);
if (!details.isEmpty()) {
fullMessage += "\n\nDetails:\n" + details;
}
sentry_uuid_s const uuid = reportSentryException(SENTRY_LEVEL_ERROR, "AppController got notified of a fatal error", "Exception",
fullMessage.toLocal8Bit());
QMessageBox::critical(nullptr, tr("Error"), message);
void AppController::onFatalError(Exception const &exception) {
sentry_uuid_t uuid = reportSentryException("AppController got notified of a fatal error", exception);
QMessageBox::critical(nullptr, tr("Error"), exception.what());
restart(true);
log().fatal(QString("reportID: %1 Captured exception: %2").arg(QByteArray(uuid.bytes, 16).toHex(), fullMessage));
log().fatal(QString("reportID: %1 Captured exception: %2").arg(QByteArray(uuid.bytes, 16).toHex(), exception.detailedWhat()));
qApp->exit(EXIT_FAILURE);
}