diff --git a/internal/frontend/bridge-gui/bridge-gui/main.cpp b/internal/frontend/bridge-gui/bridge-gui/main.cpp index dc8eca14..4de4b027 100644 --- a/internal/frontend/bridge-gui/bridge-gui/main.cpp +++ b/internal/frontend/bridge-gui/bridge-gui/main.cpp @@ -415,7 +415,11 @@ int main(int argc, char *argv[]) { } catch (Exception const &e) { sentry_uuid_s const uuid = reportSentryException("Exception occurred during main", e); - QMessageBox::critical(nullptr, "Error", e.qwhat()); + QString message = e.qwhat(); + if (e.showSupportLink()) { + message += R"(

If the issue persists, please contact our customer support.)"; + } + QMessageBox::critical(nullptr, "Error", message); QTextStream(stderr) << "reportID: " << QByteArray(uuid.bytes, 16).toHex() << " Captured exception :" << e.detailedWhat() << "\n"; return EXIT_FAILURE; } diff --git a/internal/frontend/bridge-gui/bridgepp/bridgepp/Exception/Exception.cpp b/internal/frontend/bridge-gui/bridgepp/bridgepp/Exception/Exception.cpp index db43cac0..54cf3d1d 100644 --- a/internal/frontend/bridge-gui/bridgepp/bridgepp/Exception/Exception.cpp +++ b/internal/frontend/bridge-gui/bridgepp/bridgepp/Exception/Exception.cpp @@ -26,14 +26,16 @@ namespace bridgepp { /// \param[in] what A description of the exception. /// \param[in] details The optional details for the exception. /// \param[in] function The name of the calling function. +/// \param[in] showSupportLink Should a link to the support web form be included in GUI message. //**************************************************************************************************************************************************** -Exception::Exception(QString qwhat, QString details, QString function, QByteArray attachment) noexcept +Exception::Exception(QString qwhat, QString details, QString function, QByteArray attachment, bool showSupportLink) noexcept : std::exception() , qwhat_(std::move(qwhat)) , what_(qwhat_.toLocal8Bit()) , details_(std::move(details)) , function_(std::move(function)) - , attachment_(std::move(attachment)) { + , attachment_(std::move(attachment)) + , showSupportLink_(showSupportLink) { } @@ -46,7 +48,8 @@ Exception::Exception(Exception const &ref) noexcept , what_(ref.what_) , details_(ref.details_) , function_(ref.function_) - , attachment_(ref.attachment_) { + , attachment_(ref.attachment_) + , showSupportLink_(ref.showSupportLink_) { } @@ -59,7 +62,8 @@ Exception::Exception(Exception &&ref) noexcept , what_(ref.what_) , details_(ref.details_) , function_(ref.function_) - , attachment_(ref.attachment_) { + , attachment_(ref.attachment_) + , showSupportLink_(ref.showSupportLink_) { } @@ -118,4 +122,12 @@ QString Exception::detailedWhat() const { } +//**************************************************************************************************************************************************** +/// \return true iff A link to the support page should shown in the GUI message box. +//**************************************************************************************************************************************************** +bool Exception::showSupportLink() const { + return showSupportLink_; +} + + } // namespace bridgepp diff --git a/internal/frontend/bridge-gui/bridgepp/bridgepp/Exception/Exception.h b/internal/frontend/bridge-gui/bridgepp/bridgepp/Exception/Exception.h index 3b78821f..78b9c351 100644 --- a/internal/frontend/bridge-gui/bridgepp/bridgepp/Exception/Exception.h +++ b/internal/frontend/bridge-gui/bridgepp/bridgepp/Exception/Exception.h @@ -33,7 +33,7 @@ namespace bridgepp { class Exception : public std::exception { public: // member functions explicit Exception(QString qwhat = QString(), QString details = QString(), QString function = QString(), - QByteArray attachment = QByteArray()) noexcept; ///< Constructor + QByteArray attachment = QByteArray(), bool showSupportLink = false) noexcept; ///< Constructor Exception(Exception const &ref) noexcept; ///< copy constructor Exception(Exception &&ref) noexcept; ///< copy constructor Exception &operator=(Exception const &) = delete; ///< Disabled assignment operator @@ -45,6 +45,7 @@ public: // member functions QString function() const noexcept; ///< Return the function that threw the exception. QByteArray attachment() const noexcept; ///< Return the attachment for the exception. QString detailedWhat() const; ///< Return the detailed description of the message (i.e. including the function name and the details). + bool showSupportLink() const; ///< Return the value for the 'Show support link' option. public: // static data members static qsizetype const attachmentMaxLength {25 * 1024}; ///< The maximum length text attachment sent in Sentry reports, in bytes. @@ -55,6 +56,7 @@ private: // data members QString const details_; ///< The optional details for the exception. QString const function_; ///< The name of the function that created the exception. QByteArray const attachment_; ///< The attachment to add to the exception. + bool const showSupportLink_; ///< Should the GUI feedback include a link to support. }; diff --git a/internal/frontend/bridge-gui/bridgepp/bridgepp/GRPC/GRPCClient.cpp b/internal/frontend/bridge-gui/bridgepp/bridgepp/GRPC/GRPCClient.cpp index 3c66c5aa..2a638fff 100644 --- a/internal/frontend/bridge-gui/bridgepp/bridgepp/GRPC/GRPCClient.cpp +++ b/internal/frontend/bridge-gui/bridgepp/bridgepp/GRPC/GRPCClient.cpp @@ -72,8 +72,8 @@ GRPCConfig GRPCClient::waitAndRetrieveServiceConfig(QString const & sessionID, Q bool found = false; while (true) { if (serverProcess && serverProcess->getStatus().ended) { - throw Exception("Bridge application exited before providing a gRPC service configuration file.", QString(), __FUNCTION__, - tailOfLatestBridgeLog(sessionID)); + throw Exception("Bridge failed to start.", "Bridge application exited before providing a gRPC service configuration file", __FUNCTION__, + tailOfLatestBridgeLog(sessionID), true); } if (file.exists()) {