diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2017-01-31 18:07:55 +0100 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2017-03-11 15:41:40 +0100 |
commit | aa668f74e95617fd0544327a2b57bf654a6f9a2d (patch) | |
tree | 1dd7e6b16cf6d88f3a64757fc4f9289e4b41a359 /include/DeviceCommunicationExceptions.h | |
parent | 48ec48d2c680b9f40d2b038fda9555bfd024bb97 (diff) | |
download | libnitrokey-aa668f74e95617fd0544327a2b57bf654a6f9a2d.tar.gz libnitrokey-aa668f74e95617fd0544327a2b57bf654a6f9a2d.tar.bz2 |
Be tread-safe on initializing instance
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'include/DeviceCommunicationExceptions.h')
-rw-r--r-- | include/DeviceCommunicationExceptions.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/include/DeviceCommunicationExceptions.h b/include/DeviceCommunicationExceptions.h new file mode 100644 index 0000000..78fc625 --- /dev/null +++ b/include/DeviceCommunicationExceptions.h @@ -0,0 +1,31 @@ +#ifndef LIBNITROKEY_DEVICECOMMUNICATIONEXCEPTIONS_H +#define LIBNITROKEY_DEVICECOMMUNICATIONEXCEPTIONS_H + +#include <exception> +#include <string> +//class DeviceCommunicationException: public std::exception { +class DeviceCommunicationException: public std::runtime_error{ + std::string message; +public: + DeviceCommunicationException(std::string _msg): runtime_error(_msg), message(_msg){} +// virtual const char* what() const throw() override { +// return message.c_str(); +// } +}; + +class DeviceNotConnected: public DeviceCommunicationException { +public: + DeviceNotConnected(std::string msg) : DeviceCommunicationException(msg){} +}; + +class DeviceSendingFailure: public DeviceCommunicationException { +public: + DeviceSendingFailure(std::string msg) : DeviceCommunicationException(msg){} +}; + +class DeviceReceivingFailure: public DeviceCommunicationException { +public: + DeviceReceivingFailure(std::string msg) : DeviceCommunicationException(msg){} +}; + +#endif //LIBNITROKEY_DEVICECOMMUNICATIONEXCEPTIONS_H |