From 7482318b0a0b0b0fc83cc61dbbcd41903c546dab Mon Sep 17 00:00:00 2001
From: Martyn Gigg <martyn.gigg@gmail.com>
Date: Tue, 18 Feb 2020 11:14:48 +0000
Subject: [PATCH] Tidy up exception handling to catch by reference

Also dont hardcode the title string of the notficiation
---
 qt/widgets/common/src/MessageDisplay.cpp      | 2 +-
 qt/widgets/common/src/NotificationService.cpp | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/qt/widgets/common/src/MessageDisplay.cpp b/qt/widgets/common/src/MessageDisplay.cpp
index ee9fa84593a..993684a75e9 100644
--- a/qt/widgets/common/src/MessageDisplay.cpp
+++ b/qt/widgets/common/src/MessageDisplay.cpp
@@ -244,7 +244,7 @@ void MessageDisplay::append(const Message &msg) {
     if (msg.priority() <= Message::Priority::PRIO_ERROR) {
 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
       NotificationService::showMessage(
-          "Mantid Workbench",
+          parentWidget() ? parentWidget()->windowTitle() : "Mantid",
           "Sorry, there was an error, please look at the message display for "
           "details.",
           NotificationService::MessageIcon::Critical);
diff --git a/qt/widgets/common/src/NotificationService.cpp b/qt/widgets/common/src/NotificationService.cpp
index 3eaf4822fcf..7e6986aba3f 100644
--- a/qt/widgets/common/src/NotificationService.cpp
+++ b/qt/widgets/common/src/NotificationService.cpp
@@ -27,7 +27,7 @@ void NotificationService::showMessage(const QString &title,
     if (windowIcon.isNull()) {
       try {
         windowIcon = QIcon(":/images/MantidIcon.ico");
-      } catch (std::exception) {
+      } catch (const std::exception &) {
         // if we cannot use the embedded icon, use a blank one
         windowIcon = QIcon(QPixmap(32, 32));
       }
@@ -48,11 +48,11 @@ bool NotificationService::isEnabled() {
     retVal = Mantid::Kernel::ConfigService::Instance()
                  .getValue<bool>(NOTIFICATIONS_ENABLED_KEY)
                  .get_value_or(true);
-  } catch (Mantid::Kernel::Exception::FileError) {
+  } catch (const Mantid::Kernel::Exception::FileError &) {
     // The Config Service could not find the properties file
     // Disable notifications
     retVal = false;
-  } catch (Poco::ExistsException) {
+  } catch (const Poco::ExistsException &) {
     // The Config Service could not find the properties file
     // Disable notifications
     retVal = false;
-- 
GitLab