summaryrefslogtreecommitdiff
path: root/include/DeviceCommunicationExceptions.h
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2017-10-10 18:25:32 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2017-10-10 18:25:32 +0200
commit343e4b1e6d53f042df84e951209b5a33b9a617c3 (patch)
treeba771942520fe6649d6e47a223814a260b9c5f31 /include/DeviceCommunicationExceptions.h
parentfa871ecba4333ffe9a96b0a662b9d77089cf69b7 (diff)
parentbe675e293fe94a4a6926125a61e67e92e8788d8a (diff)
downloadlibnitrokey-343e4b1e6d53f042df84e951209b5a33b9a617c3.tar.gz
libnitrokey-343e4b1e6d53f042df84e951209b5a33b9a617c3.tar.bz2
Merge branch 'test_organize'
Improve test organization Disable CRC check Improve log
Diffstat (limited to 'include/DeviceCommunicationExceptions.h')
-rw-r--r--include/DeviceCommunicationExceptions.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/DeviceCommunicationExceptions.h b/include/DeviceCommunicationExceptions.h
index 2913975..4dbd35d 100644
--- a/include/DeviceCommunicationExceptions.h
+++ b/include/DeviceCommunicationExceptions.h
@@ -6,6 +6,7 @@
#include <stdexcept>
#include <string>
+
class DeviceCommunicationException: public std::runtime_error
{
std::string message;
@@ -14,6 +15,7 @@ public:
DeviceCommunicationException(std::string _msg): std::runtime_error(_msg), message(_msg){
++occurred;
}
+ const uint8_t getType() const {return 1;};
// virtual const char* what() const throw() override {
// return message.c_str();
// }
@@ -24,21 +26,26 @@ public:
class DeviceNotConnected: public DeviceCommunicationException {
public:
DeviceNotConnected(std::string msg) : DeviceCommunicationException(msg){}
+ const uint8_t getType(){return 2;};
+
};
class DeviceSendingFailure: public DeviceCommunicationException {
public:
DeviceSendingFailure(std::string msg) : DeviceCommunicationException(msg){}
+ const uint8_t getType(){return 3;};
};
class DeviceReceivingFailure: public DeviceCommunicationException {
public:
DeviceReceivingFailure(std::string msg) : DeviceCommunicationException(msg){}
+ const uint8_t getType(){return 4;};
};
class InvalidCRCReceived: public DeviceReceivingFailure {
public:
InvalidCRCReceived(std::string msg) : DeviceReceivingFailure(msg){}
+ const uint8_t getType(){return 5;};
};