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 <dhanya.thattil@psi.ch>
This commit is contained in:
Erik Fröjdh 2023-07-26 16:35:52 +02:00 committed by GitHub
parent 7383b13f16
commit 565858b6c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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