From 565858b6c6321d050831545376bca1b623affab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Fr=C3=B6jdh?= Date: Wed, 26 Jul 2023 16:35:52 +0200 Subject: [PATCH] Explicit constructors for exceptions (#791) * silence warnings * making constructors explicit to avoid unintended conversions * changed struct to class since we already have public: --------- Co-authored-by: Dhanya Thattil --- .../include/sls/sls_detector_exceptions.h | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/slsSupportLib/include/sls/sls_detector_exceptions.h b/slsSupportLib/include/sls/sls_detector_exceptions.h index 927bb1e29..421b60549 100644 --- a/slsSupportLib/include/sls/sls_detector_exceptions.h +++ b/slsSupportLib/include/sls/sls_detector_exceptions.h @@ -5,46 +5,46 @@ namespace sls { -struct RuntimeError : public std::runtime_error { +class RuntimeError : public std::runtime_error { public: RuntimeError(); - RuntimeError(const std::string &msg); - RuntimeError(const char *msg); + explicit RuntimeError(const std::string &msg); + explicit RuntimeError(const char *msg); }; -struct SharedMemoryError : public RuntimeError { +class SharedMemoryError : public RuntimeError { public: - SharedMemoryError(const std::string &msg); + explicit SharedMemoryError(const std::string &msg); }; -struct SocketError : public RuntimeError { +class SocketError : public RuntimeError { public: - SocketError(const std::string &msg); + explicit SocketError(const std::string &msg); }; -struct ZmqSocketError : public RuntimeError { +class ZmqSocketError : public RuntimeError { public: - ZmqSocketError(const std::string &msg); + explicit ZmqSocketError(const std::string &msg); }; -struct NotImplementedError : public RuntimeError { +class NotImplementedError : public RuntimeError { public: - NotImplementedError(const std::string &msg); + explicit NotImplementedError(const std::string &msg); }; -struct DetectorError : public RuntimeError { +class DetectorError : public RuntimeError { public: - DetectorError(const std::string &msg); + explicit DetectorError(const std::string &msg); }; -struct ReceiverError : public RuntimeError { +class ReceiverError : public RuntimeError { public: - ReceiverError(const std::string &msg); + explicit ReceiverError(const std::string &msg); }; -struct GuiError : public RuntimeError { +class GuiError : public RuntimeError { public: - GuiError(const std::string &msg); + explicit GuiError(const std::string &msg); }; } // namespace sls